diff --git a/README.md b/README.md index 1acfc8c..46167cf 100755 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ The built-in SilverStripe search form is a very simple search engine. This plugi * `Label`: front-end field label * `Sort`: SQL sort string * `defaults`: Default attributes or settings, as opposed to those submitted through the search form (currently only configured to use `sort`). +* `submit_button_text`: Text to use on search form submit button (defaults to "Search") # Example configuration @@ -113,4 +114,5 @@ PlasticStudio\Search\SearchPageController: Sort: 'DatePublished ASC' defaults: sort: 'Title ASC' + submit_button_text: 'Go' ``` diff --git a/src/SearchControllerExtension.php b/src/SearchControllerExtension.php index bbb8435..331cfdc 100755 --- a/src/SearchControllerExtension.php +++ b/src/SearchControllerExtension.php @@ -13,6 +13,7 @@ use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\HiddenField; use SilverStripe\View\Requirements; +use SilverStripe\Core\Config\Config; class SearchControllerExtension extends DataExtension { @@ -36,8 +37,12 @@ public function SearchForm(){ $fields->push( TextField::create('query','',SearchPageController::get_query())->addExtraClass('query')->setAttribute('placeholder', 'Keywords') ); // create the form actions (we only need a submit button) + $submit_button_text = 'Search'; + if (Config::inst()->get('PlasticStudio\Search\SearchPageController', 'submit_button_text')) { + $submit_button_text = Config::inst()->get('PlasticStudio\Search\SearchPageController', 'submit_button_text'); + } $actions = FieldList::create( - FormAction::create("doSearchForm")->setTitle("Search") + FormAction::create("doSearchForm")->setTitle($submit_button_text) ); // now build the actual form object @@ -169,8 +174,12 @@ public function AdvancedSearchForm(){ } // create the form actions (we only need a submit button) + $submit_button_text = 'Search'; + if (Config::inst()->get('PlasticStudio\Search\SearchPageController', 'submit_button_text')) { + $submit_button_text = Config::inst()->get('PlasticStudio\Search\SearchPageController', 'submit_button_text'); + } $actions = FieldList::create( - FormAction::create("doSearchForm")->setTitle("Search") + FormAction::create("doSearchForm")->setTitle($submit_button_text) ); // now build the actual form object