Source of file SectionWordBankBlock.php
Size: 1,020 Bytes - Last Modified: 2021-12-23T10:11:59+00:00
/var/www/docs.ssmods.com/process/src/code/Blocks/WordBank/SectionWordBankBlock.php
12345678910111213141516171819202122232425262728293031323334353637383940414243 | <?php class SectionWordBankBlock extends Section { private static $db = array( 'Content' => 'HTMLText' ); public static $has_one = array(); public static $has_many = array( 'Phrases' => 'BankWord' ); public function getCMSFields() { $fields = parent::getCMSFields(); $saveWarning = LiteralField::create("Warning", "<p class='cms-warning-label'>Please Save changes before adding content</p>"); $sectionconfig = GridFieldConfig_RelationEditor::create() ->removeComponentsByType('GridFieldAddNewButton') ->addComponents( new GridFieldDeleteAction() ); if ($this->ID) { $sectionconfig->addComponents( new GridFieldAddNewButton() ); } else { $fields->addFieldToTab('Root.Phrases', $saveWarning); } $sectiongridField = GridField::create('Phrases', 'Phrases', $this->Phrases(), $sectionconfig); $fields->addFieldsToTab("Root.Phrases", $sectiongridField); $fields->addFieldToTab('Root.Main', HtmlEditorField::create('Content', 'Content')); return $fields; } } |