function colors_menu in Colors 7
Implements hook_menu().
File
- ./
colors.module, line 11 - Provides an API to match selectors with a color configuration.
Code
function colors_menu() {
$items = array();
$base = array(
'file' => 'colors.admin.inc',
'file path' => drupal_get_path('module', 'colors') . '/includes',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'colors_admin_settings',
),
'access arguments' => array(
'administer site configuration',
),
);
$items['admin/config/user-interface/colors'] = array(
'title' => 'Colors',
'description' => 'Adjust Colors settings.',
'type' => MENU_NORMAL_ITEM,
) + $base;
$items['admin/config/user-interface/colors/settings'] = array(
'title' => 'Settings',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
) + $base;
// Create a local task for each plugin.
colors_include_api();
foreach (module_implements('colors_info') as $module) {
// Because a module can provide more than one color type, the first becomes
// the default, and the rest are secondary tabs.
$first = TRUE;
foreach (module_invoke($module, 'colors_info') as $type => $info) {
if ($first) {
$items["admin/config/user-interface/colors/{$module}"] = array(
'title' => drupal_ucfirst($module),
'page arguments' => array(
'colors_generate_settings_form',
$type,
),
'type' => MENU_LOCAL_TASK,
) + $base;
}
$items["admin/config/user-interface/colors/{$module}/{$type}"] = array(
'title' => $info['title'],
'page arguments' => array(
'colors_generate_settings_form',
$type,
),
'type' => $first ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
) + $base;
$first = FALSE;
}
}
return $items;
}