public function updateCMSFields(FieldList $fields) { if (!UserSubmissionHolder::config()->enable_search_form) { return; } $parent = $this->owner->Parent(); if ($parent && $parent instanceof UserSubmissionHolder) { $fields->addFieldToTab('Root.Search', CheckboxField::create('EnableOnSearchForm', 'Show field on search form?')); $fields->addFieldToTab('Root.Search', CheckboxField::create('UseInKeywordSearch', 'Use for "Keywords" field search?')); if ($this->owner instanceof EditableDropdown) { $fieldType = 'dropdown'; $fields->addFieldToTab('Root.Search', LiteralField::create('DropdownWarning_Readonly', "<p><span style=\"color: #C00;\">Warning:</span>: This {$fieldType} field won't show on the search form until a submisson exists that uses it.<br/><br/>This {$fieldType} field will also only populate with options that have been used (ie. submitted and published).</p>")); } } }
public function UserSubmissionSearchForm() { if (!UserSubmissionHolder::config()->enable_search_form) { if ($this->request->param('Action') == __FUNCTION__) { return $this->httpError(404); } return null; } return UserSubmissionSearchForm::create($this, __FUNCTION__); }