public function getCMSFields()
    {
        
        $this->beforeUpdateCMSFields(function ($fields) {
            $config = SiteConfig::current_site_config();

            $fields->removeByName("Customisation");

            $fields->addFieldToTab(
                "Root.Main",
                ReadonlyField::create("Key"),
                "Title"
            );

            $fields->addFieldToTab(
                "Root.Main",
                DropdownField::create(
                    "TaxID",
                    $this->fieldLabel("TaxID"),
                    $config->TaxRates()->map()
                ),
                "Weight"
            );

            $fields->addFieldsToTab(
                "Root.Description",
                [
                    HTMLEditorField::create("Content")
                        ->addExtraClass("stacked")
                ]
            );

            // Change unlink button to remove on customisation
            $custom_field = $fields->dataFieldByName("Customisations");

            if ($custom_field) {
                $config = $custom_field->getConfig();
                $config
                    ->removeComponentsByType(GridFieldDeleteAction::class)
                    ->removeComponentsByType(GridFieldDataColumns::class)
                    ->removeComponentsByType(GridFieldEditButton::class)
                    ->removeComponentsByType(GridFieldAddNewButton::class)
                    ->removeComponentsByType(GridFieldAddExistingAutocompleter::class)
                    ->addComponents(
                        new GridFieldEditableColumns(),
                        new GridFieldAddNewInlineButton(),
                        new GridFieldEditButton(),
                        new GridFieldDeleteAction()
                    );
                
                    $custom_field->setConfig($config);
            }
        });

        return parent::getCMSFields();
    }
public function getCMSFields()
    {
        
        $this->beforeUpdateCMSFields(function ($fields) {
            $config = SiteConfig::current_site_config();

            $fields->removeByName("Customisation");

            $fields->addFieldToTab(
                "Root.Main",
                ReadonlyField::create("Key"),
                "Title"
            );

            $fields->addFieldToTab(
                "Root.Main",
                DropdownField::create(
                    "TaxID",
                    $this->fieldLabel("TaxID"),
                    $config->TaxRates()->map()
                ),
                "Weight"
            );

            $fields->addFieldsToTab(
                "Root.Description",
                [
                    HTMLEditorField::create("Content")
                        ->addExtraClass("stacked")
                ]
            );

            // Change unlink button to remove on customisation
            $custom_field = $fields->dataFieldByName("Customisations");

            if ($custom_field) {
                $config = $custom_field->getConfig();
                $config
                    ->removeComponentsByType(GridFieldDeleteAction::class)
                    ->removeComponentsByType(GridFieldDataColumns::class)
                    ->removeComponentsByType(GridFieldEditButton::class)
                    ->removeComponentsByType(GridFieldAddNewButton::class)
                    ->removeComponentsByType(GridFieldAddExistingAutocompleter::class)
                    ->addComponents(
                        new GridFieldEditableColumns(),
                        new GridFieldAddNewInlineButton(),
                        new GridFieldEditButton(),
                        new GridFieldDeleteAction()
                    );
                
                    $custom_field->setConfig($config);
            }
        });

        return parent::getCMSFields();
    }
public function getCMSFields ( ) { $ this -> beforeUpdateCMSFields ( function ( $ fields ) { $ config = SiteConfig :: current_site_config ( ) ; $ fields -> removeByName ( "Customisation" ) ; $ fields -> addFieldToTab ( "Root.Main" , ReadonlyField :: create ( "Key" ) , "Title" ) ; $ fields -> addFieldToTab ( "Root.Main" , DropdownField :: create ( "TaxID" , $ this -> fieldLabel ( "TaxID" ) , $ config -> TaxRates ( ) -> map ( ) ) , "Weight" ) ; $ fields -> addFieldsToTab ( "Root.Description" , [ HTMLEditorField :: create ( "Content" ) -> addExtraClass ( "stacked" ) ] ) ; // Change unlink button to remove on customisation $ custom_field = $ fields -> dataFieldByName ( "Customisations" ) ; if ( $ custom_field ) { $ config = $ custom_field -> getConfig ( ) ; $ config -> removeComponentsByType ( GridFieldDeleteAction :: class ) -> removeComponentsByType ( GridFieldDataColumns :: class ) -> removeComponentsByType ( GridFieldEditButton :: class ) -> removeComponentsByType ( GridFieldAddNewButton :: class ) -> removeComponentsByType ( GridFieldAddExistingAutocompleter :: class ) -> addComponents ( new GridFieldEditableColumns ( ) , new GridFieldAddNewInlineButton ( ) , new GridFieldEditButton ( ) , new GridFieldDeleteAction ( ) ) ; $ custom_field -> setConfig ( $ config ) ; } } ) ; return parent :: getCMSFields ( ) ; }
Modify default field scaffolding in admin

@return FieldList
Modify default field scaffolding in admin