SilverStripe Elements Global

Global elements for SilverStripe Elements

SilverStripe Elements global

Latest Stable Version  Total Downloads

Elements-global will allow you to define specific elements as being global. Global elements can be added to pages by creating a VirtualElement that will work as a link/placeholder to the global element.

The elements that should be available globaly should implement the IElementsGlobal interface. When creating this elements via a ModelAdmin they will automatically get the flag Global set to true.

You need to specify at least one Element that implements the IElementsGlobal interface.

<?php
class HeroElement extends ElementBase implements IElementsGlobal
{
...
}

You can restrict the allowed elements to be referenced by a virtual element on a per pagetype basis on your config.yml via the virtual_elements attribute.

HomePage:
  element_relations:
    Elements:
      - HeroElement
      - DownloadElement
      - TeaserElement
      - VirtualElement
    Sidebar:
      - HeroElement
      - VirtualElement
  virtual_elements:
    Elements:
      - HeroElement

SilverStripe modules by Arillo

Made by Arillo in Berlin and Bern — Code license: MIT