2014-09-07 01:26:12 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class DocumentationSearchForm extends Form {
|
|
|
|
|
|
|
|
public function __construct($controller) {
|
2014-11-28 01:58:12 +01:00
|
|
|
|
|
|
|
//pass through the current version
|
|
|
|
$page = $controller->getPage();
|
|
|
|
if($page){
|
|
|
|
$versions = HiddenField::create('Versions','Versions',$page->getEntity()->getVersion());
|
|
|
|
}
|
|
|
|
|
2014-09-07 01:26:12 +02:00
|
|
|
$fields = new FieldList(
|
2014-09-15 11:47:45 +02:00
|
|
|
TextField::create('q', _t('DocumentationViewer.SEARCH', 'Search'), '')
|
2014-11-28 01:58:12 +01:00
|
|
|
->setAttribute('placeholder', _t('DocumentationViewer.SEARCH', 'Search')),
|
|
|
|
$versions
|
2014-09-07 01:26:12 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
$actions = new FieldList(
|
2014-09-15 11:47:45 +02:00
|
|
|
new FormAction('results', _t('DocumentationViewer.SEARCH', 'Search'))
|
2014-09-07 01:26:12 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
parent::__construct($controller, 'DocumentationSearchForm', $fields, $actions);
|
|
|
|
|
|
|
|
$this->disableSecurityToken();
|
|
|
|
$this->setFormMethod('GET');
|
2014-09-19 13:29:22 +02:00
|
|
|
$this->setFormAction($controller->Link('results'));
|
2014-09-15 11:47:45 +02:00
|
|
|
|
|
|
|
$this->addExtraClass('search');
|
|
|
|
}
|
|
|
|
}
|