Community Documentation

hook_admin_paths

7 system.api.php hook_admin_paths()
8 system.api.php hook_admin_paths()

Define administrative paths.

Modules may specify whether or not the paths they define in hook_menu() are to be considered administrative. Other modules may use this information to display those pages differently (e.g. in a modal overlay, or in a different theme).

To change the administrative status of menu items defined in another module's hook_menu(), modules should implement hook_admin_paths_alter().

Return value

An associative array. For each item, the key is the path in question, in a format acceptable to drupal_match_path(). The value for each item should be TRUE (for paths considered administrative) or FALSE (for non- administrative paths).

See also

hook_menu()

drupal_match_path()

hook_admin_paths_alter()

Related topics

▾ 11 functions implement hook_admin_paths()

block_admin_paths in modules/block/block.module
Implements hook_admin_paths().
book_admin_paths in modules/book/book.module
Implements hook_admin_paths().
node_admin_paths in modules/node/node.module
Implements hook_admin_paths().
openid_admin_paths in modules/openid/openid.module
Implements hook_admin_paths().
overlay_admin_paths in modules/overlay/overlay.module
Implements hook_admin_paths().
path_get_admin_paths in includes/path.inc
Get a list of administrative and non-administrative paths.
shortcut_admin_paths in modules/shortcut/shortcut.module
Implements hook_admin_paths().
system_admin_paths in modules/system/system.module
Implements hook_admin_paths().
taxonomy_admin_paths in modules/taxonomy/taxonomy.module
Implements hook_admin_paths().
translation_admin_paths in modules/translation/translation.module
Implements hook_admin_paths().
user_admin_paths in modules/user/user.module
Implements hook_admin_paths().

File

modules/system/system.api.php, line 469
Hooks provided by Drupal core and the System module.

Code

<?php
function hook_admin_paths() {
  $paths = array(
    'mymodule/*/add' => TRUE, 
    'mymodule/*/edit' => TRUE,
  );
  return $paths;
}
?>

Comments

Note that

Note that system_admin_paths() specifies admin/* as an admin path, so modules that only place administrative pages beneath admin (such as admin/commerce/products) should not need to implement hook_admin_paths().

To use the compiled list of

To use the compiled list of paths see
path_is_admin()

Login or register to post comments