You are here

function custompage_menu in Custom Page 6

Same name and namespace in other branches
  1. 7 custompage.module \custompage_menu()

Implementation of hook_menu().

Register menu callbacks for all custom page URLs.

File

./custompage.module, line 44
Custom Page Module

Code

function custompage_menu() {
  $items = array();
  $items['admin/build/custompage/flushcache'] = array(
    'title' => 'Flush Cache',
    'page callback' => 'custompage_flushcache',
    'access arguments' => array(
      'administer custompage',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['admin/build/custompage/settings'] = array(
    'title' => 'Custom Page Settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'custompage_settings',
    ),
    'access arguments' => array(
      'administer custompage',
    ),
    'file' => 'custompage.admin.inc',
  );
  $styled_pathes = _custompage_get_mappings();
  foreach ($styled_pathes as $path) {

    // only create callbacks for page-type components
    if ($path->type == 'block') {
      continue;
    }
    if ($path->enabled) {
      $access = array(
        'access content',
      );
    }
    else {
      $access = array(
        'administer custompage',
      );
    }
    $items[$path->path] = array(
      'title' => t($path->title),
      'page callback' => 'custompage_delegate',
      'page arguments' => array(
        $path->key,
      ),
      'access arguments' => $access,
      'type' => MENU_NORMAL_ITEM,
    );
  }
  return $items;
}