You are here

function _answers_search_form_alter in Answers 7

Same name and namespace in other branches
  1. 6 includes/answers.search.inc \_answers_search_form_alter()
  2. 7.2 includes/answers.search.inc \_answers_search_form_alter()

Pseudo implementation of hook_form_alter()

Note: This is an include file, not a separate module. So, the normal hook mechanism does not call '_answers_search_form_alter'. Rather it is called manually from within 'answers_form_alter'.

1 call to _answers_search_form_alter()
answers_form_alter in ./answers.module

File

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

Code

function _answers_search_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'views_exposed_form':
      if ($form['#action'] == '/questions/search' || $form['#action'] == '/questions/continue_ask') {

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

        // Change the length & description of the search box
        $form['keys']['#title'] = '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 appropriate, add a button for posting the question
      if ($form['#action'] == '/questions/continue_ask') {
        $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',
          ),
        );
      }
      break;
  }
}