arillo / silverstripe-elements-global
Global Elements
Installs: 1 275
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 8
Forks: 1
Open Issues: 5
Type:silverstripe-vendormodule
Requires
This package is auto-updated.
Last update: 2024-12-15 17:38:03 UTC
README
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.
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