1 path.inc path_get_admin_paths()

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 backdrop_match_path(). 'non_admin': An array of non-administrative paths and regular expressions.

See also

hook_admin_paths()

hook_admin_paths_alter()

File

core/includes/path.inc, line 516
Functions to handle paths in Backdrop, including path aliasing.

Code

function path_get_admin_paths() {
  $patterns = &backdrop_static(__FUNCTION__);
  if (!isset($patterns)) {
    $paths = module_invoke_all('admin_paths');
    backdrop_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;
}