Source of file ListingSearchForm.php
Size: 0,821 Bytes - Last Modified: 2021-12-23T10:51:36+00:00
/var/www/docs.ssmods.com/process/src/code/Forms/ListingSearchForm.php
1234567891011121314151617181920212223242526272829303132 | <?php class ListingSearchForm extends Form { function __construct($controller, $name) { $context = singleton('Listing')->getCustomSearchContext(); $fields = $context->getSearchFields(); // Create actions $actions = new FieldList( FormAction::create('doSearch', 'Search')->setUseButtonTag(true) ); parent::__construct($controller, $name, $fields, $actions); } function forTemplate() { return $this->renderWith(array( $this->class, 'ListingSearchForm', 'Form' )); } public function doSearch($data, $form) { $context = singleton('Listing')->getCustomSearchContext(); $results = $context->getResults($data); return $this->customise(array( 'Results' => $results ))->renderWith('Page_results'); } } |