Elemental GridField is not displaying in content block editor


#1

I’m trying to add a gridfield into a custom elemental content block, but it just doesn’t show up in the CMS. All I get is the Title field with no errors showing up.
Class is as follows:

use DNADesign\Elemental\Models\BaseElement;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor;
use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\Search\SearchContext;
use Symbiote\GridFieldExtensions\GridFieldOrderableRows;

class BlockFeatures extends BaseElement
{
private static $icon = 'font-icon-thumbnails';

private static $db = [
];

private static $has_many = [
    'Features' => FeatureBlock::class
];

private static $table_name = 'BlockFeatures';

private static $singular_name = 'features block';

private static $plural_name = 'feature blocks';

private static $description = 'Features block';

private static $controller_template = "Features";

public function getCMSFields()
{
    $fields = parent::getCMSFields();

    $config = GridFieldConfig_RecordEditor::create();
    $config->addComponent(new GridFieldOrderableRows());

    $grid1 = GridField::create(
        'Features',
        'Feature Blocks',
        $this->Features(),
        $config
    );
    $fields->addFieldToTab('Root.Main', $grid1);        

    return $fields;
}

public function getType()
{
    return 'Features';
}

}

#2

Which version of Elemental are you using?
Versions 4+ use inline editing which I don’t think work with GridFields.
Try adding private static $inline_editable = false;


#3

Thanks kaftka, worked a treat.

Cheers