Source of file SearchDashletStatic.php
Size: 1,285 Bytes - Last Modified: 2021-12-23T10:25:20+00:00
/var/www/docs.ssmods.com/process/src/code/dashlets/SearchDashletStatic.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 | <?php /** * Search listing. * * @author Nathan Glasl <nathan@symbiote.com.au> */ class SearchDashletStatic extends SearchDashlet { public static $title = "Static Search Results"; public static $cmsTitle = "Static Search Results"; public static $description = "List of Static Search Results"; private static $db = array( 'SearchTerm' => 'Varchar' ); public function getCMSFields() { $fields = parent::getCMSFields(); $input = new TextField('SearchTerm', 'Search'); $input->setAttribute('Placeholder', 'Search Term'); $fields->push($input); return $fields; } public function getDashletFields() { $fields = parent::getDashletFields(); $input = new TextField('SearchTerm', 'Search'); $input->setAttribute('Placeholder', 'Search Term'); $fields->push($input); return $fields; } } class SearchDashletStatic_Controller extends SearchDashlet_Controller { private static $allowed_actions = array('SearchForm'); public function SearchForm() { $form = parent::SearchForm(); if($form) { // Populate the search with the static search term that has been defined. $term = $this->data()->SearchTerm; $form->Fields()->dataFieldByName('Search')->setValue($term); $form->addExtraClass('static-search-dashlet-form'); } return $form; } } |