function quail_api_get_display_levels in Quail API 7
Returns an array of display_levels that are supported.
Parameters
string|null $display_level: (optional) A number representing the display level. When defined, the return value to only contain the display level that matches this string. When undefined, all display levels will be loaded into the display_levels array.
Return value
array An array of display levels that are supported by this module or extending modules. The array keys are the machine names for each display level.
3 calls to quail_api_get_display_levels()
- quail_api_get_default_display_level in ./
quail_api.module - Returns an array of quail test display levels, each initialized to TRUE.
- quail_api_get_display_levels_list in ./
quail_api.module - Returns a list of display levels that are supported.
- template_preprocess_quail_api_results in ./
quail_api.module - Template preprocess function for quail_api_results.tpl.php.
1 string reference to 'quail_api_get_display_levels'
- quail_api_reset_cache in ./
quail_api.module - Resets all static caches provided by this module.
File
- ./
quail_api.module, line 424 - Module file for the quail api.
Code
function quail_api_get_display_levels($display_level = NULL) {
$display_levels =& drupal_static(__FUNCTION__, NULL);
if (!isset($display_levels)) {
if ($cache = cache_get('quail_api_display_levels')) {
$display_levels = $cache->data;
}
}
if (isset($display_levels)) {
if (!is_null($display_level)) {
if (isset($display_levels[$display_level])) {
return $display_levels[$display_level];
}
return array();
}
return $display_levels;
}
$display_levels = array();
$display_levels[1] = array(
'machine_name' => 'quail_test_major',
'human_name' => t("Major Problems"),
'module' => 'quail_api',
'description' => t("Major problems represent critical failures in accessibility compliance."),
'id' => 1,
// QUAIL_TEST_SEVERE
'default' => TRUE,
);
$display_levels[2] = array(
'machine_name' => 'quail_test_minor',
'human_name' => t("Minor Problems"),
'module' => 'quail_api',
'description' => t("Minor problems represent simple failures in accessibility compliance."),
'id' => 2,
// QUAIL_TEST_MODERATE
'default' => TRUE,
);
$display_levels[3] = array(
'machine_name' => 'quail_test_suggestion',
'human_name' => t("Suggestions"),
'module' => 'quail_api',
'description' => t("Suggestions provide notes and tips on how to improve accessibility compliance."),
'id' => 3,
// QUAIL_TEST_SUGGESTION
'default' => TRUE,
);
drupal_alter('quail_api_get_display_levels', $display_levels, $display_level);
cache_set('quail_api_display_levels', $display_levels, 'cache');
if (!is_null($display_level)) {
if (isset($display_levels[$display_level])) {
return $display_levels[$display_level];
}
return array();
}
return $display_levels;
}