You are here

function quizfileupload_quiz_question_config in Quiz File Upload 7.5

Implements hook_quiz_question_config().

File

./quizfileupload.module, line 41
Quizfileupload question type for the Quiz module.

Code

function quizfileupload_quiz_question_config() {
  $form['quizfileupload_default_max_score'] = array(
    '#type' => 'textfield',
    '#title' => t('Default max score'),
    '#required' => TRUE,
    '#default_value' => variable_get('quizfileupload_default_score', 1),
  );
  $form['quizfileupload_default_extensions'] = array(
    '#type' => 'textfield',
    '#title' => t('Allowed file extensions'),
    '#description' => t('Separate extensions with a space or comma and do not include the leading dot.'),
    '#default_value' => str_replace(' ', ', ', variable_get('quizfileupload_default_extensions', QUIZFILEUPLOAD_DEFAULT_EXTENSIONS)),
    '#element_validate' => array(
      '_file_generic_settings_extensions',
    ),
    '#required' => TRUE,
  );
  $form['quizfileupload_default_filesize'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum upload size'),
    '#default_value' => variable_get('quizfileupload_default_filesize'),
    '#description' => t('Enter a value like "512" (bytes), "80 KB" (kilobytes) or "50 MB" (megabytes) in order to restrict the allowed file size. If left empty the file sizes will be limited only by PHP\'s maximum post and file upload sizes (current limit <strong>%limit</strong>).', array(
      '%limit' => format_size(file_upload_max_size()),
    )),
    '#maxlength' => 18,
    '#element_validate' => array(
      '_file_generic_settings_max_filesize',
    ),
  );
  $form['quizfileupload_upload_location'] = array(
    '#type' => 'select',
    '#title' => t('Upload location'),
    '#required' => TRUE,
    '#options' => drupal_map_assoc(array_keys(file_get_stream_wrappers())),
    '#default_value' => variable_get('quizfileupload_upload_location', 'public'),
  );
  $form['#validate'][] = 'quizfileupload_config_validate';
  return $form;
}