https://github.com/arillo/silverstripe-elements-global
Global elements for SilverStripe Elements
https://github.com/arillo/silverstripe-elements-global
php silverstripe silverstripe-elements
Last synced: 10 months ago
JSON representation
Global elements for SilverStripe Elements
- Host: GitHub
- URL: https://github.com/arillo/silverstripe-elements-global
- Owner: arillo
- License: mit
- Created: 2017-05-19T13:32:06.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2025-07-17T11:22:12.000Z (12 months ago)
- Last Synced: 2025-08-20T16:22:25.706Z (11 months ago)
- Topics: php, silverstripe, silverstripe-elements
- Language: PHP
- Homepage: https://arillo.github.io/silverstripe-elements-global/
- Size: 111 KB
- Stars: 2
- Watchers: 7
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: Readme.md
- License: License.md
Awesome Lists containing this project
README
# SilverStripe Elements global
[](https://packagist.org/packages/arillo/silverstripe-elements-global)
[](https://packagist.org/packages/arillo/silverstripe-elements-global)
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.
```yml
HomePage:
element_relations:
Elements:
- HeroElement
- DownloadElement
- TeaserElement
- VirtualElement
Sidebar:
- HeroElement
- VirtualElement
virtual_elements:
Elements:
- HeroElement
```