Source of file SearchableField.php
Size: 1,859 Bytes - Last Modified: 2021-12-23T10:58:34+00:00
/var/www/docs.ssmods.com/process/src/code/SearchableField.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 | <?php use SilverStripe\Elastica\ElasticaUtil; class SearchableField extends DataObject { private static $db = array( 'Name' => 'Varchar', // the name of the field, e.g. Title 'ClazzName' => 'Varchar', // the ClassName this field belongs to 'Type' => 'Varchar', // the elasticsearch indexing type, 'ShowHighlights' => 'Boolean', // calculate highlights in Elasticsearch 'Autocomplete' => 'Boolean', // Use this to check for autocomplete fields, 'IsInSiteTree' => 'Boolean', // Set to true if this field originates from a SiteTree object ); private static $belongs_many_many = array( 'ElasticSearchPages' => 'ElasticSearchPage', ); private static $has_one = array('SearchableClass' => 'SearchableClass'); private static $display_fields = array('Name'); public function getCMSFields() { $fields = new FieldList(); $fields->push(new TabSet('Root', $mainTab = new Tab('Main'))); $mainTab->setTitle(_t('SiteTree.TABMAIN', 'Main')); $fields->addFieldToTab('Root.Main', $cf = new TextField('ClazzName', 'Class sourced from')); $fields->addFieldToTab('Root.Main', $nf = new TextField('Name', 'Name')); $cf->setDisabled(true); $nf->setDisabled(true); $cf->setReadOnly(true); $nf->setReadOnly(true); return $fields; } /* Deletion/inactivity is handled by scripts. Not end user deletable */ public function canDelete($member = null) { return false; } /* Creation is handled by scripts at build time, not end user creatable */ public function canCreate($member = null) { return false; } public function HumanReadableSearchable() { return ElasticaUtil::showBooleanHumanReadable($this->Searchable); } } |