A basic item handling permissions for elemental blocks with children

Installs: 4 954

Dependents: 4

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0


1.2.1 2024-04-19 14:43 UTC

This package is auto-updated.

Last update: 2024-06-19 14:59:54 UTC


SilverStripe elemental base item

🎭 Tests phpstan codecov composer Packagist Version

This module adds a blank base item which you can use to add sub-items to elements and a gridfield config which mimics the parent ElementalArea feel for these Items, allowing an editor to handle these "blocks" like elements.

This module is best used when the goal is to create an element which acts as a holder for some content "blocks". These blocks might for example be cards, images in a gallery or slides in a carousel.


  • SilverStripe ^4
  • Silverstripe elemental ^4


composer require syntro/silverstripe-elemental-baseitem


See License


First, simply extend the base item:

use Syntro\SilverStripeElementalBaseitem\Model\BaseItem;

class Teaser extends BaseItem
    private static $displays_title_in_template = true;

    private static $db = [
        // Whatever you need for the item to render

    private static $has_one = [
        'Section' => TeaserCardsBlock::class,

By default, the baseItem has a Title and a ShowTitle field, similar to the BaseElement in elemental. They will also use the title composite field from the silverstripe-elemental module. This behaviour can be disabled by setting displays_title_in_template to false in yaml config or directly in the class.

Then, add the relation to the desired element and configure the gridfield:

use DNADesign\Elemental\Models\BaseElement;
use Syntro\SilverStripeElementalBaseitem\Forms\GridFieldConfig_ElementalChildren;

class TeaserCardsBlock extends BaseElement
    private static $has_many = [
        'Teasers' => Teaser::class

     * @return FieldList
    public function getCMSFields()
        $this->beforeUpdateCMSFields(function ($fields) {
            if ($this->ID) {
                /** @var GridField $griditems */
                $griditems = $fields->fieldByName('Root.Teasers.Teasers');
        return parent::getCMSFields();



Bugs are tracked in the issues section of this repository. Before submitting an issue please read over existing issues to ensure yours is unique.

If the issue does look like a new bug:

  • Create a new issue
  • Describe the steps required to reproduce your issue, and the expected outcome. Unit tests, screenshots and screencasts can help here.
  • Describe your environment as detailed as possible: SilverStripe version, Browser, PHP version, Operating System, any installed SilverStripe modules.

Please report security issues to the module maintainers directly. Please don't file security issues in the bugtracker.

Development and contribution

If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers.