You are here

function answers_form_alter in Answers 7

Same name and namespace in other branches
  1. 5.2 answers.module \answers_form_alter()
  2. 6 answers.module \answers_form_alter()
  3. 7.4 answers.module \answers_form_alter()
  4. 7.2 answers.module \answers_form_alter()

File

./answers.module, line 131

Code

function answers_form_alter(&$form, &$form_state, $form_id) {
  global $user;
  _answers_notify_form_alter($form, $form_state, $form_id);
  _answers_search_form_alter($form, $form_state, $form_id);
  switch ($form_id) {
    case 'question_node_form':

      // Change the name of the submit button
      $form['actions']['submit']['#value'] = t('Ask Your Question');

      // insert a predefined question title if one has been set in the path
      if (isset($_GET['title'])) {
        $title = check_plain($_GET['title']);
        drupal_set_title(t('Add some details to your question'));
        $form['title']['#default_value'] = $title;
      }

      // Hide 'field_question_locked_p' (this is only used behind the scenes, not directly set by users)
      $form['field_question_locked_p']['#prefix'] = '<div style="display: none;">';
      $form['field_question_locked_p']['#suffix'] = '</div>';
      break;
  }
}