You are here

function _answers_search_form_views_exposed_form_alter in Answers 7.3

Same name and namespace in other branches
  1. 6.2 includes/answers.search.inc \_answers_search_form_views_exposed_form_alter()

Pseudo implementation of hook_form_alter().

See also

answers_form_alter()

1 call to _answers_search_form_views_exposed_form_alter()
answers_form_views_exposed_form_alter in ./answers.module
Implements hook_form_FORM_ID_alter() for views_exposed_form().

File

includes/answers.search.inc, line 85
Search functions for the 'Answers' module.

Code

function _answers_search_form_views_exposed_form_alter(&$form, &$form_state) {
  $view = $form_state['view'];

  // @FIXME This appears to be checking for what view/display it's altering?
  if ($view->name == 'questions_list' && ($view->current_display == 'page_5' || $view->current_display == 'page_4')) {

    // Delete the title from the search box.
    $form['#info']['filter-keys']['label'] = '';

    // Change the length & description of the search box.
    $form['keys']['#title'] = t('Question');
    $form['keys']['#size'] = 80;
    $form['keys']['#attributes']['title'] = t('Enter your question');

    // Change the title of the standard search button.
    $form['submit']['#value'] = t('Search');
  }

  // If "Continue question display", add a button for posting the question.
  if ($view->name == 'questions_list' && $view->current_display == 'page_5') {
    $form['submit']['#value'] = t('Search Again');
    $form['continue_ask'] = array(
      '#type' => 'submit',
      '#name' => 'test',
      '#value' => t('Continue With Your Question'),
      '#submit' => array(
        'answers_continue_ask_submit',
      ),
    );
  }
}