src/ModelAdminPlus.php
public function getEditForm($id = null, $fields = null)
    {
        $form = parent::getEditForm($id, $fields);
        $grid_field = $form
            ->Fields()
            ->fieldByName($this->sanitiseClassName($this->modelClass));

        // Add bulk editing to gridfield
        $manager = new BulkManager();
        $manager->removeBulkAction(UnlinkHandler::class);

        $config = $grid_field->getConfig();

        $config
            ->removeComponentsByType(GridFieldPaginator::class)
            ->addComponent($manager)
            ->addComponent(new GridFieldConfigurablePaginator());

        // Switch to custom filter header
        $config
            ->removeComponentsByType(SSGridFieldFilterHeader::class)
            ->addComponent(new GridFieldFilterHeader(
                false,
                function ($context) {
                    $this->extend('updateSearchContext', $context);
                },
                function ($form) {
                    $this->extend('updateSearchForm', $form);
                }
            ));

        if (!$this->showSearchForm ||
            (is_array($this->showSearchForm) && !in_array($this->modelClass, $this->showSearchForm))
        ) {
            $config->removeComponentsByType(GridFieldFilterHeader::class);
        }

        if ($this->config()->auto_convert_dates) {
            GridFieldDateFinder::create($grid_field)->convertDateFields();
        }

        return $form;
    }
public function getEditForm($id = null, $fields = null)
    {
        $form = parent::getEditForm($id, $fields);
        $grid_field = $form
            ->Fields()
            ->fieldByName($this->sanitiseClassName($this->modelClass));

        // Add bulk editing to gridfield
        $manager = new BulkManager();
        $manager->removeBulkAction(UnlinkHandler::class);

        $config = $grid_field->getConfig();

        $config
            ->removeComponentsByType(GridFieldPaginator::class)
            ->addComponent($manager)
            ->addComponent(new GridFieldConfigurablePaginator());

        // Switch to custom filter header
        $config
            ->removeComponentsByType(SSGridFieldFilterHeader::class)
            ->addComponent(new GridFieldFilterHeader(
                false,
                function ($context) {
                    $this->extend('updateSearchContext', $context);
                },
                function ($form) {
                    $this->extend('updateSearchForm', $form);
                }
            ));

        if (!$this->showSearchForm ||
            (is_array($this->showSearchForm) && !in_array($this->modelClass, $this->showSearchForm))
        ) {
            $config->removeComponentsByType(GridFieldFilterHeader::class);
        }

        if ($this->config()->auto_convert_dates) {
            GridFieldDateFinder::create($grid_field)->convertDateFields();
        }

        return $form;
    }
public function getEditForm ( $ id = null , $ fields = null ) { $ form = parent :: getEditForm ( $ id , $ fields ) ; $ grid_field = $ form -> Fields ( ) -> fieldByName ( $ this -> sanitiseClassName ( $ this -> modelClass ) ) ; // Add bulk editing to gridfield $ manager = new BulkManager ( ) ; $ manager -> removeBulkAction ( UnlinkHandler :: class ) ; $ config = $ grid_field -> getConfig ( ) ; $ config -> removeComponentsByType ( GridFieldPaginator :: class ) -> addComponent ( $ manager ) -> addComponent ( new GridFieldConfigurablePaginator ( ) ) ; // Switch to custom filter header $ config -> removeComponentsByType ( SSGridFieldFilterHeader :: class ) -> addComponent ( new GridFieldFilterHeader ( false , function ( $ context ) { $ this -> extend ( 'updateSearchContext' , $ context ) ; } , function ( $ form ) { $ this -> extend ( 'updateSearchForm' , $ form ) ; } ) ) ; if ( ! $ this -> showSearchForm || ( is_array ( $ this -> showSearchForm ) && ! in_array ( $ this -> modelClass , $ this -> showSearchForm ) ) ) { $ config -> removeComponentsByType ( GridFieldFilterHeader :: class ) ; } if ( $ this -> config ( ) -> auto_convert_dates ) { GridFieldDateFinder :: create ( $ grid_field ) -> convertDateFields ( ) ; } return $ form ; }
Add bulk editor to Edit Form

@param int|null  $id
@param FieldList $fields

@return Form A Form object
Add bulk editor to Edit Form