You are here

function styleguide_palette_menu in Style Guide 7

Implements hook_menu().

File

styleguide_palette/styleguide_palette.module, line 11
Stores and displays color palettes and swatches.

Code

function styleguide_palette_menu() {
  $items['admin/config/user-interface/styleguide-palette'] = array(
    'title' => 'Style guide palette',
    'description' => 'View color palettes.',
    'page callback' => 'styleguide_palette_page',
    'access arguments' => array(
      'view style guides',
    ),
    'file' => 'styleguide_palette.admin.inc',
  );
  $items['admin/config/user-interface/styleguide-palette/view'] = array(
    'title' => 'View',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['admin/config/user-interface/styleguide-palette/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'styleguide_palette_form',
    ),
    'access arguments' => array(
      'configure style guide palettes',
    ),
    'file' => 'styleguide_palette.admin.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => -5,
  );
  $items['admin/config/user-interface/styleguide-palette/delete/%styleguide_palette_swatch'] = array(
    'title' => 'Delete swatch',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'styleguide_palette_swatch_delete_form',
      5,
    ),
    'access arguments' => array(
      'configure style guide palettes',
    ),
    'file' => 'styleguide_palette.admin.inc',
  );
  $default = variable_get('theme_default', 'bartik');
  foreach (list_themes() as $theme) {
    if (!$theme->status) {
      continue;
    }
    $is_default = $theme->name == $default;
    $items["admin/config/user-interface/styleguide-palette/view/{$theme->name}"] = array(
      'title' => $theme->info['name'],
      'page callback' => 'styleguide_palette',
      'page arguments' => array(
        $theme->name,
      ),
      'access arguments' => array(
        'view style guides',
      ),
      'file' => 'styleguide_palette.admin.inc',
      'type' => $is_default ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
      'weight' => -10,
    );
    $items["admin/config/user-interface/styleguide-palette/edit/{$theme->name}"] = array(
      'title' => $theme->info['name'],
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'styleguide_palette_form',
        $theme->name,
      ),
      'access arguments' => array(
        'configure style guide palettes',
      ),
      'file' => 'styleguide_palette.admin.inc',
      'type' => $is_default ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
      'weight' => -5,
    );
  }
  return $items;
}