targetFragment = $targetFragment; $this->importFormField = $importFormField; } /** * Place the export button in a

tag below the field * * @param GridField $gridField * @return array */ public function getHTMLFragments($gridField) { $button = new GridField_FormAction( $gridField, 'import', _t('TableListField.CSVIMPORT', 'Import CSV'), 'import', null ); $button->addExtraClass('btn btn-secondary no-ajax font-icon-upload btn--icon-large action_import'); $button ->setAttribute('data-toggle', "modal") ->setAttribute('data-target', "#". $gridField->ID() . ' .grid-field-import'); $button->setForm($gridField->getForm()); $extra = null; if($this->importFormField) { $extra = ($this->importFormField instanceof Form) ? $this->importFormField->forTemplate() : $this->importFormField->Field(); } return array( $this->targetFragment => ($extra) ? '

' . $button->Field() . '

'.$extra : '', ); } /** * export is an action button * * @param GridField $gridField * @return array */ public function getActions($gridField) { return []; } }