mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00:00
Merge pull request #54 from camfindlay/curentversionsearch
Pass the current version to the search
This commit is contained in:
commit
653a2c87f4
@ -3,18 +3,25 @@
|
||||
class DocumentationSearchForm extends Form {
|
||||
|
||||
public function __construct($controller) {
|
||||
$versions = HiddenField::create(
|
||||
'Versions',
|
||||
_t('DocumentationViewer.VERSIONS', 'Versions'),
|
||||
implode(',', $controller->getManifest()->getAllVersions())
|
||||
);
|
||||
|
||||
|
||||
$fields = new FieldList(
|
||||
TextField::create('q', _t('DocumentationViewer.SEARCH', 'Search'), '')
|
||||
->setAttribute('placeholder', _t('DocumentationViewer.SEARCH', 'Search')),
|
||||
$versions
|
||||
->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'))
|
||||
);
|
||||
@ -24,7 +31,7 @@ class DocumentationSearchForm extends Form {
|
||||
$this->disableSecurityToken();
|
||||
$this->setFormMethod('GET');
|
||||
$this->setFormAction($controller->Link('results'));
|
||||
|
||||
|
||||
$this->addExtraClass('search');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user