BUGFIX: check if a request is present before using it to prevent undefined errors

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@104608 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Will Rossiter 2010-05-11 21:07:50 +00:00 committed by Sam Minnee
parent 17c67c7869
commit bec9438973

View File

@ -15,7 +15,12 @@ class ContentControllerSearchExtension extends Extension {
* Site search form * Site search form
*/ */
function SearchForm() { function SearchForm() {
$searchText = ($s = $this->owner->request->getVar('Search')) ? $s : _t('SearchForm.SEARCH', 'Search'); $searchText = _t('SearchForm.SEARCH', 'Search');
if($this->owner->request) {
$searchText = $this->owner->request->getVar('Search');
}
$fields = new FieldSet( $fields = new FieldSet(
new TextField('Search', false, $searchText) new TextField('Search', false, $searchText)
); );