diff --git a/src/Extensions/ElementalAreasExtension.php b/src/Extensions/ElementalAreasExtension.php index 73853718..c3c889e6 100644 --- a/src/Extensions/ElementalAreasExtension.php +++ b/src/Extensions/ElementalAreasExtension.php @@ -202,7 +202,11 @@ public function updateCMSFields(FieldList $fields) $editor = ElementalAreaField::create($eaRelationship, $area, $this->getElementalTypes()); - if ($this->owner instanceof SiteTree && $fields->findOrMakeTab('Root.Main')->fieldByName('Metadata')) { + $insertBefore = Config::inst()->get(get_class($this->owner), 'insert_before_field_name'); + + if ($insertBefore && $fields->dataFieldByName($insertBefore)) { + $fields->insertBefore($insertBefore, $editor); + } else if ($this->owner instanceof SiteTree && $fields->findOrMakeTab('Root.Main')->fieldByName('Metadata')) { $fields->addFieldToTab('Root.Main', $editor, 'Metadata'); } else { $fields->addFieldToTab('Root.Main', $editor);