public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName(array('Options')); // get a list of data lists to select from $allLists = DataObject::get('DynamicList'); $options = array('Please create a DynamicList!' => '(No DynamicLists available)'); if ($allLists) { /* @var $allLists DataObjectSet */ $options = $allLists->map('Title', 'Title'); } $fields->addFieldToTab('Root.Main', DropdownField::create('ListTitle', _t('EditableDataListField.DYNAMICLIST_TITLE', 'List Title'), $options)); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); // select another form field that has the titles of the lists to use for this list when displayed // The assumption being made here is that each entry in the source list has a corresponding dynamic list // defined for it, which we use later on. $options = array(); if ($this->Parent()) { $sourceList = $this->Parent()->Fields(); if ($sourceList) { $options = $sourceList->map('Name', 'Title'); } } $fields->addFieldToTab('Root.Main', DropdownField::create('SourceList', _t('EditableDependentDynamicListField.SOURCE_LIST_TITLE', 'Source List'), $options)); return $fields; }