Can someone please explain how to extend the SearchForm class.
My aim is to modify the default text and button text initially, but will probably extend to more changes later.
I have located the function in this file " \saphire\search\ContentControllerExtension.php"
The easy thing to do would be to make the changes in this file. But messing with the core files is not ideal of course.
I have tried extending the Searchform.php class as follows:
Create new class "SiteSearch.php" in mycode
class SiteSearch extends SearchForm {
function __construct($controller,$name){
parent::__construct($controller,$name);
}
}
Putting $SiteSearch in my template and I get the default form rendering OK. But I get the error below.
Any help would be much appreciated.
[User Error] Uncaught Exception: Object->__call(): the method 'getviewer' does not exist on 'DataObjectSet'
GET /home/SiteSearch?Search=&action_getResults=Go
Line 724 in E:\websites\IRIS\v2\sapphire\core\Object.php
Source
715
716 default :
717 throw new Exception (
718 "Object->__call(): extra method $method is invalid on $this->class:" . var_export($config, true)
719 );
720 }
721 } else {
722 // Please do not change the exception code number below.
723
724 throw new Exception("Object->__call(): the method '$method' does not exist on '$this->class'", 2175);
725 }
726 }
727
728 // -----------------------------------------------------------------------------------------------------------------
729
730 /**
Trace
* Object->__call(getViewer,Array)
* DataObjectSet->getViewer(SiteSearch)
Line 155 of Controller.php
* Controller->handleRequest(SS_HTTPRequest)
Line 199 of ContentController.php
* ContentController->handleRequest(SS_HTTPRequest)
Line 67 of ModelAsController.php
* ModelAsController->handleRequest(SS_HTTPRequest)
Line 283 of Director.php
* Director::handleRequest(SS_HTTPRequest,Session)
Line 127 of Director.php
* Director::direct(home/SiteSearch)
Line 127 of main.php