From 0c7e0f774036d2db63d07890fd843995edc206b1 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Fri, 10 Jan 2014 09:50:25 +0000 Subject: [PATCH] Issue #2170635 by jhodgdon: Remove leftover SearchForm (duplicate of renamed SearchPageForm). --- .../lib/Drupal/search/Form/SearchForm.php | 121 ------------------ 1 file changed, 121 deletions(-) delete mode 100644 core/modules/search/lib/Drupal/search/Form/SearchForm.php diff --git a/core/modules/search/lib/Drupal/search/Form/SearchForm.php b/core/modules/search/lib/Drupal/search/Form/SearchForm.php deleted file mode 100644 index 35b0ff9ea88..00000000000 --- a/core/modules/search/lib/Drupal/search/Form/SearchForm.php +++ /dev/null @@ -1,121 +0,0 @@ -get('plugin.manager.search') - ); - } - - /** - * Constructs a search form. - * - * @param \Drupal\search\SearchPluginManager $search_plugin - * The search plugin manager. - */ - public function __construct(SearchPluginManager $search_plugin) { - $this->searchManager = $search_plugin; - } - - /** - * {@inheritdoc} - */ - public function getFormID() { - return 'search_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, array &$form_state, SearchInterface $plugin = NULL, $action = '', $prompt = NULL) { - $plugin_info = $plugin->getPluginDefinition(); - - if (!$action) { - $action = 'search/' . $plugin_info['path']; - } - if (!isset($prompt)) { - $prompt = $this->t('Enter your keywords'); - } - - $form['#action'] = $this->urlGenerator()->generateFromPath($action); - // Record the $action for later use in redirecting. - $form_state['action'] = $action; - $form['plugin_id'] = array( - '#type' => 'value', - '#value' => $plugin->getPluginId(), - ); - $form['basic'] = array( - '#type' => 'container', - '#attributes' => array( - 'class' => array('container-inline'), - ), - ); - $form['basic']['keys'] = array( - '#type' => 'search', - '#title' => $prompt, - '#default_value' => $plugin->getKeywords(), - '#size' => $prompt ? 30 : 20, - '#maxlength' => 255, - ); - // processed_keys is used to coordinate keyword passing between other forms - // that hook into the basic search form. - $form['basic']['processed_keys'] = array( - '#type' => 'value', - '#value' => '', - ); - $form['basic']['submit'] = array( - '#type' => 'submit', - '#value' => $this->t('Search'), - ); - // Allow the plugin to add to or alter the search form. - $plugin->searchFormAlter($form, $form_state); - - return $form; - } - - /** - * {@inheritdoc} - */ - public function validateForm(array &$form, array &$form_state) { - form_set_value($form['basic']['processed_keys'], trim($form_state['values']['keys']), $form_state); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, array &$form_state) { - $keys = $form_state['values']['processed_keys']; - if ($keys == '') { - $this->setFormError('keys', $form_state, $this->t('Please enter some keywords.')); - // Fall through to the form redirect. - } - - $form_state['redirect'] = $form_state['action'] . '/' . $keys; - } -}