You are here

function path_get_admin_paths in Drupal 7

Gets a list of administrative and non-administrative paths.

Return value

array An associative array containing the following keys: 'admin': An array of administrative paths and regular expressions in a format suitable for drupal_match_path(). 'non_admin': An array of non-administrative paths and regular expressions.

See also

hook_admin_paths()

hook_admin_paths_alter()

2 calls to path_get_admin_paths()
overlay_overlay_parent_initialize in modules/overlay/overlay.module
Implements hook_overlay_parent_initialize().
path_is_admin in includes/path.inc
Determines whether a path is in the administrative section of the site.

File

includes/path.inc, line 520
Functions to handle paths in Drupal, including path aliasing.

Code

function path_get_admin_paths() {
  $patterns =& drupal_static(__FUNCTION__);
  if (!isset($patterns)) {
    $paths = module_invoke_all('admin_paths');
    drupal_alter('admin_paths', $paths);

    // Combine all admin paths into one array, and likewise for non-admin paths,
    // for easier handling.
    $patterns = array();
    $patterns['admin'] = array();
    $patterns['non_admin'] = array();
    foreach ($paths as $path => $enabled) {
      if ($enabled) {
        $patterns['admin'][] = $path;
      }
      else {
        $patterns['non_admin'][] = $path;
      }
    }
    $patterns['admin'] = implode("\n", $patterns['admin']);
    $patterns['non_admin'] = implode("\n", $patterns['non_admin']);
  }
  return $patterns;
}