You are here

quiz_matching.module in Quiz 8.6

Matching question type for the Quiz module.

Allows the creation of matching questions, which associate one term with another.

File

question_types/quiz_matching/quiz_matching.module
View source
<?php

/**
 * @file
 * Matching question type for the Quiz module.
 *
 * Allows the creation of matching questions, which associate one term
 * with another.
 */

/**
 * Implements hook_help().
 */
function matching_help($path, $args) {
  switch ($path) {
    case 'admin/modules#description':
      return t('Matching question type for quiz module.');
    case 'quiz/add#matching':
    case 'admin/help#matching':
      return t('A question type for the quiz module: allows you to create matching type questions, which connect terms with one another.');
    default:
      break;
  }
}

/**
 * Implements hook_quiz_question_config().
 */
function matching_quiz_question_config() {
  $form['quiz_matching_form_size'] = array(
    '#type' => 'number',
    '#min' => 2,
    '#max' => 50,
    '#title' => t('Match Question Size'),
    '#description' => t('Number of questions allowed to wrap under a matching type question.'),
    '#default_value' => \Drupal::config('quiz.settings')
      ->get('matching_form_size', 5),
  );
  $form['quiz_matching_shuffle_options'] = array(
    '#type' => 'checkbox',
    '#title' => t('Shuffle Matching Questions'),
    '#default_value' => \Drupal::config('quiz.settings')
      ->get('matching_shuffle_options', TRUE),
    '#description' => t('If checked matching questions will be shuffled'),
  );
  $form['#validate'][] = 'matching_config_validate';
  return $form;
}

/**
 * Implements hook_theme().
 */
function matching_theme() {
  return array(
    'matching_question_form' => array(
      'render element' => 'form',
      'path' => drupal_get_path('module', 'matching') . '/theme',
      'file' => 'matching.theme.inc',
    ),
    'matching_response' => array(
      'variables' => array(
        'metadata' => NULL,
        'data' => NULL,
      ),
      'path' => drupal_get_path('module', 'matching') . '/theme',
      'file' => 'matching.theme.inc',
    ),
    'matching_subquestion_form' => array(
      'render element' => 'form',
      'path' => drupal_get_path('module', 'matching') . '/theme',
      'file' => 'matching.theme.inc',
    ),
    'matching_match_node_view' => array(
      'variables' => array(
        'subquestions' => NULL,
      ),
      'path' => drupal_get_path('module', 'matching') . '/theme',
      'file' => 'matching.theme.inc',
    ),
    'matching_answering_form' => array(
      'render element' => 'form',
      'path' => drupal_get_path('module', 'matching') . '/theme',
      'template' => 'matching-answering-form',
    ),
  );
}

Functions

Namesort descending Description
matching_help Implements hook_help().
matching_quiz_question_config Implements hook_quiz_question_config().
matching_theme Implements hook_theme().