public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Required'); $fields->replaceField('Default', new CheckboxField('Default')); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Options', new NumericField('Rows', 'Number of rows')); $fields->addFieldToTab('Root.Main', new LiteralField('KeywordNote', '<p>Keyword replacements in the form "$FieldName"' . ' or "$Member.FieldName" can be used in the default value, as well' . ' as in the actual metadata value. These will be replaced with the' . ' corresponding field from the record the schema is applied to.<p>')); $fields->dataFieldByName('Default')->setRows(3); return $fields; }
public function getCMSFields() { Requirements::javascript(METADATA_DIR . '/javascript/MetadataDateFieldCms.js'); $fields = parent::getCMSFields(); $fields->removeByName('Default'); $default = $this->getFormField(); $default->setName('Default'); $default->setTitle('Default'); $fields->addFieldsToTab('Root.Main', array(new OptionsetField('Type', 'Field type', array('datetime' => 'A combination date and time field', 'date' => 'Date only', 'time' => 'Time only')), new OptionSetField('DefaultType', 'Default to', array('specific' => 'A specific date/time', 'created' => 'The time the object was created')), $default)); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Subject'); $fields->removeByName('Default'); $classes = ClassInfo::subclassesFor('DataObject'); $subjects = array(); array_shift($classes); sort($classes); foreach ($classes as $class) { $subjects[$class] = singleton($class)->singular_name() . " ({$class})"; } $subject = new DropdownField('SubjectClass', 'Relationship subject class', $subjects, null, null, true); $fields->addFieldToTab('Root.Main', $subject, 'Required'); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Subject'); $fields->removeByName('Default'); $classes = ClassInfo::subclassesFor('DataObject'); $subjects = array(); array_shift($classes); sort($classes); foreach ($classes as $class) { $subjects[$class] = singleton($class)->singular_name() . " ({$class})"; } $subject = DropdownField::create('SubjectClass', 'Relationship subject class', $subjects, null, null)->setHasEmptyDefault(true); $fields->addFieldToTab('Root.Main', $subject, 'Required'); $fields->dataFieldByName('SelectAny')->setRightTitle('Select any item of this type'); return $fields; }
public function getCMSFields() { Requirements::javascript(METADATA_DIR . '/javascript/MetadataSelectFieldCms.js'); $fields = parent::getCMSFields(); $fields->removeByName('Options'); $fields->removeByName('Default'); $fields->removeByName('EmptyMode'); $fields->removeByName('EmptyText'); $default = $this->getFormField(); $default->setName('Default'); $default->setTitle('Default option(s)'); $default->setValue($this->Default); $gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldAddNewButton(), new GridFieldFilterHeader(), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(15), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm(), new GridFieldSortableRows('Sort'), new MetaDataFieldAddForm()); $gridField = new GridField('Options', 'Options', $this->Options(), $gridFieldConfig); $fields->addFieldsToTab('Root.Main', array(new DropdownField('Type', 'Field type', array('dropdown' => 'Dropdown select field', 'optionset' => 'Set of radio options', 'checkboxset' => 'Checkbox set field (allows multiple selection)')))); $fields->addFieldsToTab('Root.Options', array($default, new OptionsetField('EmptyMode', 'Empty first option', array('none' => 'Do not display an empty default option', 'blank' => 'Display an empty option as the first option', 'text' => 'Display an empty option with text as the first option')), new TextField('EmptyText', 'Empty Text'), new HeaderField('OptionsHeader', 'Options'), $gridField)); return $fields; }
public function __construct($id, $name) { parent::__construct($id, $name); }