public function updateCMSFields(FieldList $fields)
    {
        if (!$this->supportsElemental()) {
            return;
        }

        // add an empty holder for content as some module explicitly use insert
        // after content.
        $fields->replaceField('Content', new LiteralField('Content', ''));
        $elementalAreaRelations = $this->owner->getElementalRelations();

        foreach ($elementalAreaRelations as $eaRelationship) {
            $key = $eaRelationship . 'ID';

            // remove the scaffold dropdown
            $fields->removeByName($key);

            // remove the field, but don't add anything.
            if (!$this->owner->isInDb()) {
                continue;
            }

            // Example: $eaRelationship = 'ElementalArea';
            $area = $this->owner->$eaRelationship();

            $editor = ElementalAreaField::create($eaRelationship, $area, $this->getElementalTypes());

            if ($this->owner instanceof SiteTree && $fields->findOrMakeTab('Root.Main')->fieldByName('Metadata')) {
                $fields->addFieldToTab('Root.Main', $editor, 'Metadata');
            } else {
                $fields->addFieldToTab('Root.Main', $editor);
            }
        }

        return $fields;
    }
public function updateCMSFields(FieldList $fields)
    {
        if (!$this->supportsElemental()) {
            return;
        }

        // add an empty holder for content as some module explicitly use insert
        // after content.
        $fields->replaceField('Content', new LiteralField('Content', ''));
        $elementalAreaRelations = $this->owner->getElementalRelations();

        foreach ($elementalAreaRelations as $eaRelationship) {
            $key = $eaRelationship . 'ID';

            // remove the scaffold dropdown
            $fields->removeByName($key);

            // remove the field, but don't add anything.
            if (!$this->owner->isInDb()) {
                continue;
            }

            // Example: $eaRelationship = 'ElementalArea';
            $area = $this->owner->$eaRelationship();

            $editor = ElementalAreaField::create($eaRelationship, $area, $this->getElementalTypes());

            if ($this->owner instanceof SiteTree && $fields->findOrMakeTab('Root.Main')->fieldByName('Metadata')) {
                $fields->addFieldToTab('Root.Main', $editor, 'Metadata');
            } else {
                $fields->addFieldToTab('Root.Main', $editor);
            }
        }

        return $fields;
    }
public function updateCMSFields ( FieldList $ fields ) { if ( ! $ this -> supportsElemental ( ) ) { return ; } // add an empty holder for content as some module explicitly use insert // after content. $ fields -> replaceField ( 'Content' , new LiteralField ( 'Content' , '' ) ) ; $ elementalAreaRelations = $ this -> owner -> getElementalRelations ( ) ; foreach ( $ elementalAreaRelations as $ eaRelationship ) { $ key = $ eaRelationship . 'ID' ; // remove the scaffold dropdown $ fields -> removeByName ( $ key ) ; // remove the field, but don't add anything. if ( ! $ this -> owner -> isInDb ( ) ) { continue ; } // Example: $eaRelationship = 'ElementalArea'; $ area = $ this -> owner -> $ eaRelationship ( ) ; $ editor = ElementalAreaField :: create ( $ eaRelationship , $ area , $ this -> getElementalTypes ( ) ) ; if ( $ this -> owner instanceof SiteTree && $ fields -> findOrMakeTab ( 'Root.Main' ) -> fieldByName ( 'Metadata' ) ) { $ fields -> addFieldToTab ( 'Root.Main' , $ editor , 'Metadata' ) ; } else { $ fields -> addFieldToTab ( 'Root.Main' , $ editor ) ; } } return $ fields ; }
Setup the CMS Fields

@param FieldList
Setup the CMS Fields