public function bulkEditForm()
    {
        $crumbs = $this->Breadcrumbs();
        if ($crumbs && $crumbs->count() >= 2) {
            $one_level_up = $crumbs->offsetGet($crumbs->count() - 2);
        }

        $actions = new FieldList();

        $actions->push(
            FormAction::create('doSave', _t('GRIDFIELD_BULKMANAGER_EDIT_HANDLER.SAVE_BTN_LABEL', 'Save all'))
                ->setAttribute('id', 'bulkEditingSaveBtn')
                ->addExtraClass('btn btn-success')
                ->setAttribute('data-icon', 'accept')
                ->setUseButtonTag(true)
        );

        $actions->push(
            FormAction::create('Cancel', _t('GRIDFIELD_BULKMANAGER_EDIT_HANDLER.CANCEL_BTN_LABEL', 'Cancel'))
                ->setAttribute('id', 'bulkEditingUpdateCancelBtn')
                ->addExtraClass('btn btn-danger cms-panel-link')
                ->setAttribute('data-icon', 'decline')
                ->setAttribute('href', $one_level_up->Link)
                ->setUseButtonTag(true)
                ->setAttribute('src', '')//changes type to image so isn't hooked by default actions handlers
        );

        $recordList = $this->getRecordIDList();
        $recordsFieldList = new FieldList();
        $config = $this->component->getConfig();

        $editingCount = count($recordList);
        $modelClass = $this->gridField->getModelClass();
        $singleton = singleton($modelClass);
        $titleModelClass = (($editingCount > 1) ? $singleton->i18n_plural_name() : $singleton->i18n_singular_name());

        //some cosmetics
        $headerText = _t(
            'GRIDFIELD_BULKMANAGER_EDIT_HANDLER.HEADER_TEXT',
            'Editing {count} {class}',
            array(
                'count' => $editingCount,
                'class' => $titleModelClass,
            )
        );
        $header = LiteralField::create(
            'bulkEditHeader',
            '<h1 id="bulkEditHeader">'.$headerText.'</h1>'
        );
        $recordsFieldList->push($header);

        $toggle = LiteralField::create(
            'bulkEditToggle',
            '<span id="bulkEditToggle">' . _t('GRIDFIELD_BULKMANAGER_EDIT_HANDLER.TOGGLE_ALL_LINK', 'Show/Hide all') . '</span>'
        );
        $recordsFieldList->push($toggle);

        //fetch fields for each record and push to fieldList
        foreach ($recordList as $id) {
            $record = DataObject::get_by_id($modelClass, $id);
            $recordEditingFields = $this->getRecordEditingFields($record);

            $toggleField = ToggleCompositeField::create(
                'RecordFields_' . $id,
                $record->getTitle(),
                $recordEditingFields
            )
            ->setHeadingLevel(4)
            ->setAttribute('data-id', $id)
            ->addExtraClass('bulkEditingFieldHolder');

            $recordsFieldList->push($toggleField);
        }

        $bulkEditForm = Form::create(
            $this,
            'recordEditForm', //recordEditForm name is here to trick SS to pass all subform request to recordEditForm()
            $recordsFieldList,
            $actions
        );

        if ($crumbs && $crumbs->count() >= 2) {
            $bulkEditForm->Backlink = $one_level_up->Link;
        }

        //override form action URL back to bulkEditForm
        //and add record ids GET var
        $bulkEditForm->setAttribute(
            'action',
            $this->Link('bulkEditForm?records[]='.implode('&', $recordList))
        );

        return $bulkEditForm;
    }
public function bulkEditForm()
    {
        $crumbs = $this->Breadcrumbs();
        if ($crumbs && $crumbs->count() >= 2) {
            $one_level_up = $crumbs->offsetGet($crumbs->count() - 2);
        }

        $actions = new FieldList();

        $actions->push(
            FormAction::create('doSave', _t('GRIDFIELD_BULKMANAGER_EDIT_HANDLER.SAVE_BTN_LABEL', 'Save all'))
                ->setAttribute('id', 'bulkEditingSaveBtn')
                ->addExtraClass('btn btn-success')
                ->setAttribute('data-icon', 'accept')
                ->setUseButtonTag(true)
        );

        $actions->push(
            FormAction::create('Cancel', _t('GRIDFIELD_BULKMANAGER_EDIT_HANDLER.CANCEL_BTN_LABEL', 'Cancel'))
                ->setAttribute('id', 'bulkEditingUpdateCancelBtn')
                ->addExtraClass('btn btn-danger cms-panel-link')
                ->setAttribute('data-icon', 'decline')
                ->setAttribute('href', $one_level_up->Link)
                ->setUseButtonTag(true)
                ->setAttribute('src', '')//changes type to image so isn't hooked by default actions handlers
        );

        $recordList = $this->getRecordIDList();
        $recordsFieldList = new FieldList();
        $config = $this->component->getConfig();

        $editingCount = count($recordList);
        $modelClass = $this->gridField->getModelClass();
        $singleton = singleton($modelClass);
        $titleModelClass = (($editingCount > 1) ? $singleton->i18n_plural_name() : $singleton->i18n_singular_name());

        //some cosmetics
        $headerText = _t(
            'GRIDFIELD_BULKMANAGER_EDIT_HANDLER.HEADER_TEXT',
            'Editing {count} {class}',
            array(
                'count' => $editingCount,
                'class' => $titleModelClass,
            )
        );
        $header = LiteralField::create(
            'bulkEditHeader',
            '<h1 id="bulkEditHeader">'.$headerText.'</h1>'
        );
        $recordsFieldList->push($header);

        $toggle = LiteralField::create(
            'bulkEditToggle',
            '<span id="bulkEditToggle">' . _t('GRIDFIELD_BULKMANAGER_EDIT_HANDLER.TOGGLE_ALL_LINK', 'Show/Hide all') . '</span>'
        );
        $recordsFieldList->push($toggle);

        //fetch fields for each record and push to fieldList
        foreach ($recordList as $id) {
            $record = DataObject::get_by_id($modelClass, $id);
            $recordEditingFields = $this->getRecordEditingFields($record);

            $toggleField = ToggleCompositeField::create(
                'RecordFields_' . $id,
                $record->getTitle(),
                $recordEditingFields
            )
            ->setHeadingLevel(4)
            ->setAttribute('data-id', $id)
            ->addExtraClass('bulkEditingFieldHolder');

            $recordsFieldList->push($toggleField);
        }

        $bulkEditForm = Form::create(
            $this,
            'recordEditForm', //recordEditForm name is here to trick SS to pass all subform request to recordEditForm()
            $recordsFieldList,
            $actions
        );

        if ($crumbs && $crumbs->count() >= 2) {
            $bulkEditForm->Backlink = $one_level_up->Link;
        }

        //override form action URL back to bulkEditForm
        //and add record ids GET var
        $bulkEditForm->setAttribute(
            'action',
            $this->Link('bulkEditForm?records[]='.implode('&', $recordList))
        );

        return $bulkEditForm;
    }
public function bulkEditForm ( ) { $ crumbs = $ this -> Breadcrumbs ( ) ; if ( $ crumbs && $ crumbs -> count ( ) >= 2 ) { $ one_level_up = $ crumbs -> offsetGet ( $ crumbs -> count ( ) - 2 ) ; } $ actions = new FieldList ( ) ; $ actions -> push ( FormAction :: create ( 'doSave' , _t ( 'GRIDFIELD_BULKMANAGER_EDIT_HANDLER.SAVE_BTN_LABEL' , 'Save all' ) ) -> setAttribute ( 'id' , 'bulkEditingSaveBtn' ) -> addExtraClass ( 'btn btn-success' ) -> setAttribute ( 'data-icon' , 'accept' ) -> setUseButtonTag ( true ) ) ; $ actions -> push ( FormAction :: create ( 'Cancel' , _t ( 'GRIDFIELD_BULKMANAGER_EDIT_HANDLER.CANCEL_BTN_LABEL' , 'Cancel' ) ) -> setAttribute ( 'id' , 'bulkEditingUpdateCancelBtn' ) -> addExtraClass ( 'btn btn-danger cms-panel-link' ) -> setAttribute ( 'data-icon' , 'decline' ) -> setAttribute ( 'href' , $ one_level_up -> Link ) -> setUseButtonTag ( true ) -> setAttribute ( 'src' , '' ) //changes type to image so isn't hooked by default actions handlers ) ; $ recordList = $ this -> getRecordIDList ( ) ; $ recordsFieldList = new FieldList ( ) ; $ config = $ this -> component -> getConfig ( ) ; $ editingCount = count ( $ recordList ) ; $ modelClass = $ this -> gridField -> getModelClass ( ) ; $ singleton = singleton ( $ modelClass ) ; $ titleModelClass = ( ( $ editingCount > 1 ) ? $ singleton -> i18n_plural_name ( ) : $ singleton -> i18n_singular_name ( ) ) ; //some cosmetics $ headerText = _t ( 'GRIDFIELD_BULKMANAGER_EDIT_HANDLER.HEADER_TEXT' , 'Editing {count} {class}' , array ( 'count' => $ editingCount , 'class' => $ titleModelClass , ) ) ; $ header = LiteralField :: create ( 'bulkEditHeader' , '<h1 id="bulkEditHeader">' . $ headerText . '</h1>' ) ; $ recordsFieldList -> push ( $ header ) ; $ toggle = LiteralField :: create ( 'bulkEditToggle' , '<span id="bulkEditToggle">' . _t ( 'GRIDFIELD_BULKMANAGER_EDIT_HANDLER.TOGGLE_ALL_LINK' , 'Show/Hide all' ) . '</span>' ) ; $ recordsFieldList -> push ( $ toggle ) ; //fetch fields for each record and push to fieldList foreach ( $ recordList as $ id ) { $ record = DataObject :: get_by_id ( $ modelClass , $ id ) ; $ recordEditingFields = $ this -> getRecordEditingFields ( $ record ) ; $ toggleField = ToggleCompositeField :: create ( 'RecordFields_' . $ id , $ record -> getTitle ( ) , $ recordEditingFields ) -> setHeadingLevel ( 4 ) -> setAttribute ( 'data-id' , $ id ) -> addExtraClass ( 'bulkEditingFieldHolder' ) ; $ recordsFieldList -> push ( $ toggleField ) ; } $ bulkEditForm = Form :: create ( $ this , 'recordEditForm' , //recordEditForm name is here to trick SS to pass all subform request to recordEditForm() $ recordsFieldList , $ actions ) ; if ( $ crumbs && $ crumbs -> count ( ) >= 2 ) { $ bulkEditForm -> Backlink = $ one_level_up -> Link ; } //override form action URL back to bulkEditForm //and add record ids GET var $ bulkEditForm -> setAttribute ( 'action' , $ this -> Link ( 'bulkEditForm?records[]=' . implode ( '&' , $ recordList ) ) ) ; return $ bulkEditForm ; }
Return a form for all the selected DataObjects
with their respective editable fields.

@return Form Selected DataObjects editable fields
Return a form for all the selected DataObjects with their respective editable fields .