You are here

function delta_menu in Delta 7

Same name and namespace in other branches
  1. 6 delta.module \delta_menu()

Implementation of hook_menu().

File

./delta.module, line 59
The Delta Theme API is an advanced manipulation of the Theme Settings API to allow for customization/configuration of theme settings based on node types, context, or groups of paths.

Code

function delta_menu() {

  /**
   * provides a menu tab inline with the theme list/configure tabs
   * this will also provide the default settings for the module
   *
   * @see http://api.drupal.org/api/function/hook_menu/6
   * @see delta_theme_settings_config()
   */
  $items['admin/build/delta'] = array(
    'title' => 'Delta Theme Settings API',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'delta_theme_settings_config',
    ),
    'access arguments' => array(
      'configure delta theme api',
    ),
    'file' => 'delta-settings.inc',
    'type' => MENU_NORMAL_ITEM,
  );

  // Default Delta API settings tab item
  $items['admin/build/delta/settings'] = array(
    'title' => 'Configure',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
  );

  // Default Delta API settings tab item
  $items['admin/build/delta/settings/global'] = array(
    'title' => 'Global Settings',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
  );

  /**
   * provide a subtab item for each theme that is currently enabled in the system
   * @todo implement a menu_cache_clear_all() after a previously unselected theme is enabled.
   */
  $themes = delta_get_themes_array();
  foreach ($themes as $id => $theme) {
    $items['admin/build/delta/settings/' . $theme->name] = array(
      'title' => $theme->info['name'],
      'page callback' => 'delta_theme_overrides',
      'page arguments' => array(
        $theme->name,
      ),
      'type' => MENU_LOCAL_TASK,
      'access arguments' => array(
        'configure delta theme api',
      ),
    );
  }
  $items['admin/build/delta/import'] = array(
    'title' => 'Import',
    'page callback' => 'delta_create_import',
    'type' => MENU_LOCAL_TASK,
    'access arguments' => array(
      'configure delta theme api',
    ),
  );
  $items['admin/build/delta/export'] = array(
    'title' => 'Export',
    'page callback' => 'delta_create_export',
    'type' => MENU_LOCAL_TASK,
    'access arguments' => array(
      'configure delta theme api',
    ),
  );

  // Callbacks

  /**
   * These items create and help the Add/Edit Override pages
   */
  $items['admin/build/delta/override/add'] = array(
    'title' => 'Add Override',
    'page callback' => 'delta_manage_override_page',
    'access arguments' => array(
      'configure delta theme api',
    ),
    'type' => MENU_LOCAL_TASK,
  );

  // AHAH Callback for the Override Add/Edit form.
  $items['delta/theme-select-theme-settings-overrides'] = array(
    'title' => 'AHAH Theme Settings Override Callback',
    'page callback' => 'delta_ahah',
    'type' => MENU_CALLBACK,
    'access arguments' => array(
      'configure delta theme api',
    ),
  );
  $items['admin/build/delta/add-template/%'] = array(
    'title' => 'Add Template',
    'page callback' => 'delta_create_theme_settings_template',
    // wildcard from URL will be the theme name
    'page arguments' => array(
      4,
    ),
    'type' => MENU_CALLBACK,
    'access arguments' => array(
      'configure delta theme api',
    ),
  );
  $items['admin/build/delta/override/manage/%/edit'] = array(
    'title' => 'Edit Override',
    'page callback' => 'delta_manage_override_page',
    'page arguments' => array(
      5,
    ),
    'access arguments' => array(
      'configure delta theme api',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['admin/build/delta/override/manage/%/delete'] = array(
    'title' => 'Delete Override',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'delta_override_delete',
      5,
    ),
    'access arguments' => array(
      'configure delta theme api',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['admin/build/delta/override/manage/%/export'] = array(
    'title' => 'Export Override',
    'page callback' => 'delta_manage_override_page',
    'page arguments' => array(
      5,
    ),
    'access arguments' => array(
      'configure delta theme api',
    ),
    'type' => MENU_CALLBACK,
  );
  return $items;
}