mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00:00
43b6d42719
This major update changes the behaviour of the docviewer module to use a cached manifest rather than on demand. This allows us to simplify the URL matching and store 'nice' URL configuration rather than altering handleAction().
32 lines
879 B
PHP
32 lines
879 B
PHP
<?php
|
|
|
|
class DocumentationSearchForm extends Form {
|
|
|
|
public function __construct($controller) {
|
|
$q = ($q = $controller->getSearchQuery()) ? $q->NoHTML() : "";
|
|
|
|
$entities = $controller->getSearchedEntities();
|
|
$versions = $controller->getSearchedVersions();
|
|
|
|
$fields = new FieldList(
|
|
new TextField('Search', _t('DocumentationViewer.SEARCH', 'Search'), $q)
|
|
);
|
|
|
|
if ($entities) $fields->push(
|
|
new HiddenField('Entities', '', implode(',', array_keys($entities)))
|
|
);
|
|
|
|
if ($versions) $fields->push(
|
|
new HiddenField('Versions', '', implode(',', $versions))
|
|
);
|
|
|
|
$actions = new FieldList(
|
|
new FormAction('results', 'Search')
|
|
);
|
|
|
|
parent::__construct($controller, 'DocumentationSearchForm', $fields, $actions);
|
|
|
|
$this->disableSecurityToken();
|
|
$this->setFormMethod('GET');
|
|
$this->setFormAction($controller->Link('DocumentationSearchForm'));
|
|
} |