You are here

function devel_node_access_menu in Devel 7

Same name and namespace in other branches
  1. 5 devel_node_access.module \devel_node_access_menu()
  2. 6 devel_node_access.module \devel_node_access_menu()

Implements hook_menu().

File

./devel_node_access.module, line 52
Functions for debugging node access permissions.

Code

function devel_node_access_menu() {
  $items = array();
  if (!module_exists('devel')) {
    if (!menu_load('devel')) {

      // We have to create the 'devel' menu ourselves.
      $menu = array(
        'menu_name' => 'devel',
        'title' => 'Development',
        'description' => 'Development link',
      );
      menu_save($menu);
    }

    // We have to create the 'Devel settings' menu item ourselves.
    $items['admin/config/development/devel'] = array(
      'title' => 'Devel settings',
      'description' => 'Helper pages and blocks to assist Drupal developers and admins with node_access. The devel blocks can be managed via the <a href="/admin/structure/block">block administration</a> page.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'devel_node_access_admin_settings',
      ),
      'access arguments' => array(
        'administer site configuration',
      ),
    );
    $items['devel/settings'] = $items['admin/config/development/devel'] + array(
      'menu_name' => 'devel',
    );
  }

  // Create a callback for use by devel_node_access_user_ajax().
  $items['devel/node_access/by_user/%/%'] = array(
    'page callback' => 'devel_node_access_user_ajax',
    'page arguments' => array(
      3,
      4,
    ),
    'access arguments' => array(
      DNA_ACCESS_VIEW,
    ),
    'type' => MENU_CALLBACK,
  );

  // Add this to the custom menu 'devel' created by the devel module.
  $items['devel/node_access/summary'] = array(
    'title' => 'Node_access summary',
    'page callback' => 'dna_summary',
    'access arguments' => array(
      DNA_ACCESS_VIEW,
    ),
    'menu_name' => 'devel',
  );
  return $items;
}