You are here

function icon_menu in Icon API 7

Implements hook_menu().

File

./icon.module, line 66
icon.module Provides icon integration with menu items.

Code

function icon_menu() {
  $module_path = drupal_get_path('module', 'icon');
  $items = array();
  $items[ICON_ADMIN_PATH] = array(
    'title' => 'Icons',
    'description' => 'Overview of all available icons.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'icon_bundle_overview_form',
    ),
    'access arguments' => array(
      'administer icons',
    ),
    'file' => 'admin.inc',
    'file path' => $module_path . '/includes',
  );
  $items[ICON_ADMIN_PATH . '/overview'] = array(
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'title' => 'Bundles',
    'description' => 'Overview of all available icon bundles.',
    'weight' => -10,
  );
  $import_providers = icon_providers_support_import();
  if (!empty($import_providers)) {
    $items[ICON_ADMIN_PATH . '/import'] = array(
      'type' => MENU_LOCAL_TASK,
      'title' => 'Import',
      'description' => 'Import a bundle from a provider.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'icon_provider_import_form',
      ),
      'access arguments' => array(
        'administer icons',
      ),
      'file' => 'import.inc',
      'file path' => $module_path . '/includes',
    );
  }
  $items[ICON_ADMIN_PATH . '/bundle/%icon_bundle'] = array(
    'title callback' => 'icon_bundle_get_title',
    'title arguments' => array(
      5,
    ),
    'description' => 'An icon bundle.',
    'page callback' => 'icon_bundle_list',
    'page arguments' => array(
      5,
    ),
    'access arguments' => array(
      'administer icons',
    ),
    'theme callback' => 'icon_bundle_get_theme',
    'theme arguments' => array(
      5,
    ),
    'file' => 'admin.inc',
    'file path' => $module_path . '/includes',
  );
  $items[ICON_ADMIN_PATH . '/bundle/%icon_bundle/icons'] = array(
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'title' => 'Icons',
    'description' => 'Provide an overview of all available icon bundles.',
    'weight' => -10,
  );
  $items[ICON_ADMIN_PATH . '/bundle/%icon_bundle/configure'] = array(
    'type' => MENU_LOCAL_TASK,
    'title' => 'Configure',
    'description' => 'Form callback for configuring an icon bundle.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'icon_bundle_configure_form',
      5,
    ),
    'access arguments' => array(
      'administer icons',
    ),
    'file' => 'admin.inc',
    'file path' => $module_path . '/includes',
  );
  $items[ICON_ADMIN_PATH . '/bundle/%icon_bundle/delete'] = array(
    'title' => 'Delete',
    'description' => 'Confirmation page for deleting an icon bundle from the database.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'icon_bundle_delete_form',
      5,
    ),
    'type' => MENU_CALLBACK,
    'access arguments' => array(
      'administer icons',
    ),
    'file' => 'admin.inc',
    'file path' => $module_path . '/includes',
  );
  $items[ICON_ADMIN_PATH . '/bundle/%icon_bundle/reset'] = array(
    'title' => 'Reset',
    'description' => 'Confirmation page for resetting a module or theme provided bundle that has been overridden in the database.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'icon_bundle_reset_form',
      5,
    ),
    'type' => MENU_CALLBACK,
    'access arguments' => array(
      'administer icons',
    ),
    'file' => 'admin.inc',
    'file path' => $module_path . '/includes',
  );

  // The actual path will be set in hook_menu_alter() but we want the item to be
  // defined here to let the menu system fill-in defaults. To ensure we do not
  // have path collisions, we just temporarily a child of our admin path.
  $view_path_alias = ICON_ADMIN_PATH . '/tmp';
  $items[$view_path_alias] = $items[ICON_ADMIN_PATH];
  $items[$view_path_alias]['access arguments'] = array(
    'view icons',
  );
  $items[$view_path_alias . '/%icon_bundle'] = $items[ICON_ADMIN_PATH . '/bundle/%icon_bundle'];
  $items[$view_path_alias . '/%icon_bundle']['access arguments'] = array(
    'view icons',
  );
  $items[$view_path_alias . '/%icon_bundle']['title arguments'] = array(
    1,
  );
  $items[$view_path_alias . '/%icon_bundle']['page arguments'] = array(
    1,
  );
  $items[$view_path_alias . '/%icon_bundle']['theme arguments'] = array(
    1,
  );
  return $items;
}