You are here

function quiz_form_quiz_node_form_submit in Quiz 7.6

Same name and namespace in other branches
  1. 7.4 quiz.module \quiz_form_quiz_node_form_submit()
  2. 7.5 quiz.module \quiz_form_quiz_node_form_submit()

Quiz node form submit callback.

Redirect the user to the questions form if there are no questions in the Quiz.

See also

quiz_form_quiz_node_form_alter()

1 string reference to 'quiz_form_quiz_node_form_submit'
quiz_form_quiz_node_form_alter in ./quiz.module
Implements hook_form_FORM_ID_alter() for the quiz node form.

File

./quiz.module, line 595
quiz.module Main file for the Quiz module.

Code

function quiz_form_quiz_node_form_submit($form, &$form_state) {
  $node = $form_state['node'];
  if (!entity_load('quiz_question_relationship', FALSE, array(
    'parent_vid' => $node->vid,
  ))) {
    drupal_set_message(t('You just created a new @quiz. Now you have to add questions to it. This page is for adding and managing questions. Here you can create new questions or add some of your already created questions. If you want to change the quiz settings, you can use the "edit" tab.', array(
      '@quiz' => QUIZ_NAME,
    )));
    $form_state['redirect'] = 'node/' . $node->nid . '/quiz/questions';
  }
}