Example #1
0
 /**
  * @param string|NULL $slug
  */
 public function actionDefault($slug)
 {
     if (!$slug) {
         $this->error();
     }
     $this->search = $this->searchManager->search($slug);
     if ($this->search === NULL) {
         $this->error();
     }
 }
Example #2
0
 /**
  * @return Form
  */
 protected function createComponentSearchForm()
 {
     $form = new Form();
     $form->setTranslator($this->translator);
     $form->addProtection();
     $defaultSearchValue = $this->search ? $this->search->getInput() : NULL;
     $form->addText('search')->setRequired()->setValue($defaultSearchValue);
     $form->addSubmit('submit');
     $form->onSuccess[] = function (Form $form) {
         $search = $this->searchManager->saveSearch($form->getValues()->search);
         $this->onSavedSearch($search);
     };
     return $form;
 }