matching.module in Quiz 7
Same filename and directory in other branches
- 8.4 question_types/matching/matching.module
- 6.6 question_types/matching/matching.module
- 6.3 question_types/matching/matching.module
- 6.4 question_types/matching/matching.module
- 6.5 question_types/matching/matching.module
- 7.6 question_types/matching/matching.module
- 7.4 question_types/matching/matching.module
- 7.5 question_types/matching/matching.module
Matching question type for quiz module
Allows the creation of matching questions, which associate one term with another
File
question_types/matching/matching.moduleView source
<?php
/**
* @file
* Matching question type for 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 'node/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_info().
*/
function matching_quiz_question_info() {
return array(
'matching' => array(
'name' => t('Matching'),
'description' => t('Matching question type for quiz module. A question type for the quiz module: allows you to create matching type questions, which connect terms with one another.'),
'question provider' => 'MatchingQuestion',
'response provider' => 'MatchingResponse',
'module' => 'quiz_question',
),
);
}
/**
* hook_config
*
* @return FAPI array
*/
function matching_config() {
$form['quiz_matching_form_size'] = array(
'#type' => 'textfield',
'#title' => t('Match Question Size'),
'#description' => t('Number of questions allowed to wrap under a matching type question.'),
'#default_value' => variable_get('quiz_matching_form_size', 5),
);
$form['quiz_matching_shuffle_options'] = array(
'#type' => 'checkbox',
'#title' => t('Shuffle Matching Questions'),
'#default_value' => variable_get('quiz_matching_shuffle_options', TRUE),
'#description' => t('If checked matching questions will be shuffled'),
);
$form['#validate'] = 'matching_config_validate';
return $form;
}
/**
* Validate the matching config form values
*/
function matching_config_validate($form, $form_state) {
if (!_quiz_is_int($form_state['values']['quiz_matching_form_size'], 2, 50)) {
form_set_error('quiz_matching_form_size', t('The number of questions must be between 2 and 50'));
}
}
/**
* 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
Name | Description |
---|---|
matching_config | hook_config |
matching_config_validate | Validate the matching config form values |
matching_help | Implements hook_help(). |
matching_quiz_question_info | Implements hook_quiz_question_info(). |
matching_theme | Implements hook_theme(). |