Make sure option gridfield is created before the UpdateCMSFields function so we can override fields in extensions

This commit is contained in:
Ryan O'Hara 2016-11-28 16:26:27 +13:00
parent aa171f8e45
commit 8af5ff93c3

View File

@ -33,8 +33,7 @@ class EditableMultipleOptionField extends EditableFormField
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$this->beforeUpdateCMSFields(function($fields) {
$editableColumns = new GridFieldEditableColumns();
$editableColumns->setDisplayFields(array(
'Title' => array(
@ -77,6 +76,9 @@ class EditableMultipleOptionField extends EditableFormField
$fields->insertAfter(new Tab('Options', _t('EditableMultipleOptionField.OPTIONSTAB', 'Options')), 'Main');
$fields->addFieldToTab('Root.Options', $optionsGrid);
});
$fields = parent::getCMSFields();
return $fields;
}