API CHANGE Removed @deprecated SearchForm::showInSearchTurnOn: Please ensure that pages which should be searched have ShowInSearch field checked in the CMS

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77394 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-05-20 07:30:02 +00:00
parent a9370a26f9
commit cd0c5db141

View File

@ -14,12 +14,6 @@
*/ */
class SearchForm extends Form { class SearchForm extends Form {
/**
* @var boolean $showInSearchTurnOn
* @deprecated 2.3 SiteTree->ShowInSearch should always be respected
*/
protected $showInSearchTurnOn;
/** /**
* @var int $pageLength How many results are shown per page. * @var int $pageLength How many results are shown per page.
* Relies on pagination being implemented in the search results template. * Relies on pagination being implemented in the search results template.
@ -38,11 +32,8 @@ class SearchForm extends Form {
* @param FieldSet $fields Optional, defaults to a single field named "Search". Search logic needs to be customized * @param FieldSet $fields Optional, defaults to a single field named "Search". Search logic needs to be customized
* if fields are added to the form. * if fields are added to the form.
* @param FieldSet $actions Optional, defaults to a single field named "Go". * @param FieldSet $actions Optional, defaults to a single field named "Go".
* @param boolean $showInSearchTurnOn DEPRECATED 2.3
*/ */
function __construct($controller, $name, $fields = null, $actions = null, $showInSearchTurnOn = true) { function __construct($controller, $name, $fields = null, $actions = null) {
$this->showInSearchTurnOn = $showInSearchTurnOn;
if(!$fields) { if(!$fields) {
$fields = new FieldSet( $fields = new FieldSet(
new TextField('Search', _t('SearchForm.SEARCH', 'Search') new TextField('Search', _t('SearchForm.SEARCH', 'Search')
@ -183,7 +174,8 @@ class SearchForm extends Form {
else $extraFilters['File'] = $extraFilters['SiteTree']; else $extraFilters['File'] = $extraFilters['SiteTree'];
} }
if($this->showInSearchTurnOn) $extraFilters['SiteTree'] .= " AND showInSearch <> 0"; // Always ensure that only pages with ShowInSearch = 1 can be searched
$extraFilters['SiteTree'] .= " AND ShowInSearch <> 0";
$start = isset($_GET['start']) ? (int)$_GET['start'] : 0; $start = isset($_GET['start']) ? (int)$_GET['start'] : 0;
$limit = $start . ", " . (int) $pageLength; $limit = $start . ", " . (int) $pageLength;