Compare commits

..

1 Commits

View File

@ -66,7 +66,7 @@ class UserFormFieldEditorExtension extends Extension
{ {
$fieldEditor = $this->getFieldEditorGrid(); $fieldEditor = $this->getFieldEditorGrid();
$fields->insertAfter('Main', Tab::create('FormFields', _t(__CLASS__.'.FORMFIELDS', 'Form Fields'))); $fields->insertAfter('Main', new Tab('FormFields', _t(__CLASS__.'.FORMFIELDS', 'Form Fields')));
$fields->addFieldToTab('Root.FormFields', $fieldEditor); $fields->addFieldToTab('Root.FormFields', $fieldEditor);
return $fields; return $fields;
@ -87,7 +87,7 @@ class UserFormFieldEditorExtension extends Extension
$this->createInitialFormStep(true); $this->createInitialFormStep(true);
$editableColumns = GridFieldEditableColumns::create(); $editableColumns = new GridFieldEditableColumns();
$fieldClasses = singleton(EditableFormField::class)->getEditableFieldClasses(); $fieldClasses = singleton(EditableFormField::class)->getEditableFieldClasses();
$editableColumns->setDisplayFields([ $editableColumns->setDisplayFields([
'ClassName' => function ($record, $column, $grid) use ($fieldClasses) { 'ClassName' => function ($record, $column, $grid) use ($fieldClasses) {
@ -109,7 +109,7 @@ class UserFormFieldEditorExtension extends Extension
$config = GridFieldConfig::create() $config = GridFieldConfig::create()
->addComponents( ->addComponents(
$editableColumns, $editableColumns,
GridFieldButtonRow::create(), new GridFieldButtonRow(),
(new GridFieldAddClassesButton(EditableTextField::class)) (new GridFieldAddClassesButton(EditableTextField::class))
->setButtonName(_t(__CLASS__.'.ADD_FIELD', 'Add Field')) ->setButtonName(_t(__CLASS__.'.ADD_FIELD', 'Add Field'))
->setButtonClass('btn-primary'), ->setButtonClass('btn-primary'),
@ -119,13 +119,13 @@ class UserFormFieldEditorExtension extends Extension
(new GridFieldAddClassesButton([EditableFieldGroup::class, EditableFieldGroupEnd::class])) (new GridFieldAddClassesButton([EditableFieldGroup::class, EditableFieldGroupEnd::class]))
->setButtonName(_t(__CLASS__.'.ADD_FIELD_GROUP', 'Add Field Group')) ->setButtonName(_t(__CLASS__.'.ADD_FIELD_GROUP', 'Add Field Group'))
->setButtonClass('btn-secondary'), ->setButtonClass('btn-secondary'),
$editButton = GridFieldEditButton::create(), $editButton = new GridFieldEditButton(),
GridFieldDeleteAction::create(), new GridFieldDeleteAction(),
GridFieldToolbarHeader::create(), new GridFieldToolbarHeader(),
GridFieldOrderableRows::create('Sort'), new GridFieldOrderableRows('Sort'),
GridFieldDetailForm::create(), new GridFieldDetailForm(),
// Betterbuttons prev and next is enabled by adding a GridFieldPaginator component // Betterbuttons prev and next is enabled by adding a GridFieldPaginator component
GridFieldPaginator::create(999) new GridFieldPaginator(999)
); );
$editButton->removeExtraClass('grid-field__icon-action--hidden-on-hover'); $editButton->removeExtraClass('grid-field__icon-action--hidden-on-hover');