public function requireDefaultRecords()
 {
     if ($this->config()->get('create_default_search_page')) {
         if (GoogleSiteSearchPage::get()->count() < 1) {
             $search = new GoogleSiteSearchPage();
             $search->Title = "Search results";
             $search->MenuTitle = "Search";
             $search->ShowInMenus = 0;
             $search->GoogleKey = $this->config()->get('cse_key');
             $search->GoogleCX = $this->config()->get('cse_cx');
             $search->URLSegment = "search";
             $search->write();
             $search->doPublish('Stage', 'Live');
         }
     }
 }
 /**
  * Return a form which sends the user to the first results page. If you want
  * to customize this form, use your own extension and apply that to the
  * page.
  *
  * @return Form
  */
 public function getGoogleSiteSearchForm()
 {
     if ($page = GoogleSiteSearchPage::get()->first()) {
         $label = Config::inst()->get('GoogleSiteSearchDefaultFormExtension', 'submit_button_label');
         $formLabel = Config::inst()->get('GoogleSiteSearchDefaultFormExtension', 'input_label');
         $form = new Form($this, 'GoogleSiteSearchForm', new FieldList(new TextField('Search', $formLabel)), new FieldList(new FormAction('doSearch', $label)));
         $form->setFormMethod('GET');
         $form->setFormAction($page->Link());
         $form->disableSecurityToken();
         $form->loadDataFrom($_GET);
         return $form;
     }
 }