You are here

function question_type_menu in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/lib/questionlib.php \question_type_menu()

An array of question type names translated to the user's language, suitable for use when creating a drop-down menu of options.

Long-time Moodle programmers will realise that this replaces the old $QTYPE_MENU array. The array returned will only hold the names of all the question types that the user should be able to create directly. Some internal question types like random questions are excluded.

Return value

array an array of question type names translated to the user's language.

File

includes/moodle/lib/questionlib.php, line 175

Code

function question_type_menu() {
  global $QTYPES;
  static $menu_options = null;
  if (is_null($menu_options)) {
    $menu_options = array();
    foreach ($QTYPES as $name => $qtype) {
      $menuname = $qtype
        ->menu_name();
      if ($menuname) {
        $menu_options[$name] = $menuname;
      }
    }
  }
  return $menu_options;
}