2014-09-07 01:26:12 +02:00
|
|
|
<?php
|
|
|
|
|
2015-11-21 07:25:41 +01:00
|
|
|
class DocumentationSearchForm extends Form
|
|
|
|
{
|
|
|
|
public function __construct($controller)
|
|
|
|
{
|
|
|
|
$fields = new FieldList(
|
|
|
|
TextField::create('q', _t('DocumentationViewer.SEARCH', 'Search'), '')
|
|
|
|
->setAttribute('placeholder', _t('DocumentationViewer.SEARCH', 'Search'))
|
|
|
|
);
|
|
|
|
|
|
|
|
$page = $controller->getPage();
|
|
|
|
|
|
|
|
if ($page) {
|
|
|
|
$versions = HiddenField::create(
|
|
|
|
'Versions',
|
|
|
|
_t('DocumentationViewer.VERSIONS', 'Versions'),
|
|
|
|
$page->getEntity()->getVersion()
|
|
|
|
);
|
|
|
|
|
|
|
|
$fields->push($versions);
|
|
|
|
}
|
|
|
|
|
|
|
|
$actions = new FieldList(
|
|
|
|
new FormAction('results', _t('DocumentationViewer.SEARCH', 'Search'))
|
|
|
|
);
|
|
|
|
|
|
|
|
parent::__construct($controller, 'DocumentationSearchForm', $fields, $actions);
|
|
|
|
|
|
|
|
$this->disableSecurityToken();
|
|
|
|
$this->setFormMethod('GET');
|
|
|
|
$this->setFormAction($controller->Link('results'));
|
|
|
|
|
|
|
|
$this->addExtraClass('search');
|
|
|
|
}
|
2014-12-16 21:30:17 +01:00
|
|
|
}
|