You are here

function custompage_menu in Custom Page 7

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

Implementation of hook_menu().

Register menu callbacks for all custom page URLs.

File

./custompage.module, line 50
Custom Page Module

Code

function custompage_menu() {
  $items = array();
  $items['admin/config/system/custompage/flushcache'] = array(
    'title' => 'Flush Cache',
    'page callback' => 'custompage_flushcache',
    'access arguments' => array(
      'administer custompage',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['admin/config/system/custompage-settings'] = array(
    'title' => 'Custom Page Settings',
    'description' => 'Manage theme prefix and inline editing',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'custompage_settings',
    ),
    'access arguments' => array(
      'administer custompage',
    ),
    'file' => 'custompage.admin.inc',
  );
  $styled_paths = _custompage_get_mappings();
  foreach ($styled_paths 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;
}