admin_path.module in Administrative pages 7
Allows users to configure which pages are to be considered administrative.
See also
http://drupal.org/documentation/modules/overlay for general information about working with the core's overlay module (in folder modules/overlay).
File
admin_path.moduleView source
<?php
/**
* @file
* Allows users to configure which pages are to be considered administrative.
*
* @see http://drupal.org/documentation/modules/overlay for general information about working with the core's overlay module (in folder modules/overlay).
*/
/**
* Implements hook_help().
*/
function admin_path_help($path, $arg) {
global $user;
switch ($path) {
case 'admin/help#admin_path':
$output = '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Administrative pages module allows users to configure which pages are to be considered administrative.') . '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl><dt>' . t('Configuring administrative pages') . '</dt>';
$output .= '<dd>' . t('Users with the <em>Administer admin paths</em> permission can configure which pages are to be considered administrative on the <a href="@admin_paths">Administrative pages configuration form</a>.', array(
'@admin_paths' => url('admin/config/user-interface/admin-path'),
)) . '</dd>';
$output .= '</dl>';
return $output;
case 'admin/config/user-interface/admin-path':
$output = '<p>' . t('Configure which pages are to be considered administrative.') . '</p>';
return $output;
}
}
/**
* Implements hook_permission().
*/
function admin_path_permission() {
return array(
'administer admin paths' => array(
'title' => t('Administer admin paths'),
),
);
}
/**
* Implements hook_menu().
*/
function admin_path_menu() {
$items['admin/config/user-interface/admin-path'] = array(
'title' => 'Administrative pages',
'description' => 'Configure which pages are to be considered administrative.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'admin_path_admin',
),
'access arguments' => array(
'administer admin paths',
),
'file' => 'admin_path.admin.inc',
);
$items['admin/config/user-interface/admin-path/reset'] = array(
'title' => 'Reset administrative pages configuration',
'description' => 'Reset administrative pages configuration to global defaults.',
'type' => MENU_CALLBACK,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'admin_path_reset_confirm',
),
'access arguments' => array(
'administer admin paths',
),
'file' => 'admin_path.admin.inc',
);
return $items;
}
/**
* Implements hook_admin_paths_alter().
*/
function admin_path_admin_paths_alter(&$paths) {
$paths = variable_get('admin_path', $paths);
if (variable_get('admin_path_include_aliases', FALSE)) {
$patterns = 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']);
$path = current_path();
$alias = drupal_get_path_alias();
if (!drupal_match_path($path, $patterns['admin']) && drupal_match_path($alias, $patterns['admin']) && !drupal_match_path($alias, $patterns['non_admin'])) {
$paths[$path] = TRUE;
}
}
}
Functions
Name![]() |
Description |
---|---|
admin_path_admin_paths_alter | Implements hook_admin_paths_alter(). |
admin_path_help | Implements hook_help(). |
admin_path_menu | Implements hook_menu(). |
admin_path_permission | Implements hook_permission(). |