namespace Drupal\search\Form;
-use Drupal\Core\Entity\EntityForm;
+use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
+use Drupal\search\SearchPageInterface;
/**
* Provides a search form for site wide search.
* trigger the search being processed by the controller, and adding in any
* additional query parameters they need to execute search.
*/
-class SearchPageForm extends EntityForm {
+class SearchPageForm extends FormBase {
/**
- * {@inheritdoc}
+ * The search page entity.
*
* @var \Drupal\search\SearchPageInterface
*/
/**
* {@inheritdoc}
*/
- public function form(array $form, FormStateInterface $form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state, SearchPageInterface $search_page = NULL) {
+ $this->entity = $search_page;
+
$plugin = $this->entity->getPlugin();
$form_state->set('search_page_id', $this->entity->id());
// Allow the plugin to add to or alter the search form.
$plugin->searchFormAlter($form, $form_state);
-
- return parent::form($form, $form_state);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function actions(array $form, FormStateInterface $form_state) {
- // The submit button is added in the form directly.
- return [];
+ return $form;
}
/**