updated admin_menu, entity_translation, addressfield, addressfield_token, autocomplete_deluxe

This commit is contained in:
2019-05-13 17:41:56 +02:00
parent 472762edfa
commit 33210e10f2
65 changed files with 3124 additions and 700 deletions

View File

@@ -1,65 +1,84 @@
CONTENTS OF THIS FILE
---------------------
-- SUMMARY --
* Introduction
* Requirements
* Installation
* Configuration
* Customization
* Troubleshooting
* FAQ
* Maintainers
INTRODUCTION
------------
The Administration menu module displays the entire administrative menu tree (and
most local tasks) in a drop-down menu, providing administrators one- or
two-click access to most pages. Other modules may also add menu links to the
menu using hook_admin_menu_output_alter().
For a full description of the module, visit the project page:
http://drupal.org/project/admin_menu
For a full description of the project visit the project page:
http://drupal.org/project/admin_menu
To submit bug reports and feature suggestions, or to track changes:
http://drupal.org/project/issues/admin_menu
http://drupal.org/project/issues/admin_menu
-- REQUIREMENTS --
REQUIREMENTS
------------
None.
No special requirements
-- INSTALLATION --
INSTALLATION
------------
* Install as usual, see http://drupal.org/node/895232 for further information.
Install as you would normally install a contributed Drupal. See:
https://drupal.org/documentation/install/modules-themes/modules-7 for further
information.
* You likely want to disable Toolbar module, since its output clashes with
Administration menu.
* You likely want to disable Toolbar module, since its output clashes with
Administration menu.
-- CONFIGURATION --
CONFIGURATION
-------------
* Configure user permissions in Administration » People » Permissions:
* Configure user permissions in Administration » People » Permissions:
- Use the administration pages and help (System module)
- Use the administration pages and help (System module)
The top-level administration categories require this permission to be
accessible. The administration menu will be empty unless this permission is
granted.
The top-level administration categories require this permission to be
accessible. The administration menu will be empty unless this permission is
granted.
- Access administration menu
- Access administration menu
Users in roles with the "Access administration menu" permission will see
the administration menu at the top of each page.
Users in roles with the "Access administration menu" permission will see
the administration menu at the top of each page.
- Display Drupal links
- Display Drupal links
Users in roles with the "Display drupal links" permission will receive
links to drupal.org issue queues for all enabled contributed modules. The
issue queue links appear under the administration menu icon.
Users in roles with the "Display drupal links" permission will receive
links to drupal.org issue queues for all enabled contributed modules. The
issue queue links appear under the administration menu icon.
Note that the menu items displayed in the administration menu depend on the
actual permissions of the viewing user. For example, the "People" menu item
is not displayed to a user who is not a member of a role with the "Administer
users" permission.
Note that the menu items displayed in the administration menu depend on the
actual permissions of the viewing user. For example, the "People" menu item
is not displayed to a user who is not a member of a role with the
"Administer users" permission.
* Customize the menu settings in Administration » Configuration and modules »
Administration » Administration menu.
* Customize the menu settings in Administration » Configuration and modules »
Administration » Administration menu.
* To prevent administrative menu items from appearing twice, you may hide the
"Management" menu block.
* To prevent administrative menu items from appearing twice, you may hide the
"Management" menu block.
-- CUSTOMIZATION --
CUSTOMIZATION
-------------
* To override the default administration menu icon, you may:
@@ -82,12 +101,13 @@ None.
body #admin-menu { font-size: 10px; }
-- TROUBLESHOOTING --
TROUBLESHOOTING
-------------
* If the menu does not display, check the following:
- Are the "Access administration menu" and "Use the administration pages and help"
permissions enabled for the appropriate roles?
- Are the "Access administration menu" and "Use the administration pages and
help" permissions enabled for the appropriate roles?
- Does html.tpl.php of your theme output the $page_bottom variable?
@@ -99,90 +119,102 @@ None.
See http://drupal.org/node/195386 for further information.
-- FAQ --
FAQ
---
Q: When the administration menu module is enabled, blank space is added to the
bottom of my theme. Why?
Q: When the administration menu module is enabled, blank space is added to the
bottom of my theme. Why?
A: This is caused by a long list of links to module issue queues at Drupal.org.
Use Administer >> User management >> Permissions to disable the "display
drupal links" permission for all appropriate roles. Note that since UID 1
automatically receives all permissions, the list of issue queue links cannot
be disabled for UID 1.
A: This is caused by a long list of links to module issue queues at Drupal.org.
Use Administer >> User management >> Permissions to disable the "display
drupal links" permission for all appropriate roles. Note that since UID 1
automatically receives all permissions, the list of issue queue links cannot
be disabled for UID 1.
Q: After upgrading to 6.x-1.x, the menu disappeared. Why?
Q: After upgrading to 6.x-1.x, the menu disappeared. Why?
A: You may need to regenerate your menu. Visit
http://example.com/admin/build/modules to regenerate your menu (substitute
your site name for example.com).
A: You may need to regenerate your menu. Visit
http://example.com/admin/build/modules to regenerate your menu (substitute
your site name for example.com).
Q: Can I configure the administration menu module to display another menu (like
the Navigation menu, for instance)?
Q: Can I configure the administration menu module to display another menu (like
the Navigation menu, for instance)?
A: No. As the name implies, administration menu module is for administrative
menu links only. However, you can copy and paste the contents of
admin_menu.css into your theme's stylesheet and replace #admin-menu with any
other menu block id (#block-menu-1, for example).
A: No. As the name implies, administration menu module is for administrative
menu links only. However, you can copy and paste the contents of
admin_menu.css into your theme's stylesheet and replace #admin-menu with any
other menu block id (#block-menu-1, for example).
Q: Sometimes, the user counter displays a lot of anonymous users, but no spike
of users or requests appear in Google Analytics or other tracking tools.
Q: Sometimes, the user counter displays a lot of anonymous users, but no spike
of users or requests appear in Google Analytics or other tracking tools.
A: If your site was concurrently spidered by search-engine robots, it may have
a significant number of anonymous users for a short time. Most web tracking
tools like Google Analytics automatically filter out these requests.
A: If your site was concurrently spidered by search-engine robots, it may have
a significant number of anonymous users for a short time. Most web tracking
tools like Google Analytics automatically filter out these requests.
Q: I enabled "Aggregate and compress CSS files", but admin_menu.css is still
there. Is this normal?
Q: I enabled "Aggregate and compress CSS files", but admin_menu.css is still
there. Is this normal?
A: Yes, this is the intended behavior. the administration menu module only loads
its stylesheet as needed (i.e., on page requests by logged-on, administrative
users).
A: Yes, this is the intended behavior. the administration menu module only
loads its stylesheet as needed (i.e., on page requests by logged-on,
administrative users).
Q: Why are sub-menus not visible in Opera?
Q: Why are sub-menus not visible in Opera?
A: In the Opera browser preferences under "web pages" there is an option to fit
to width. By disabling this option, sub-menus in the administration menu
should appear.
A: In the Opera browser preferences under "web pages" there is an option to fit
to width. By disabling this option, sub-menus in the administration menu
should appear.
Q: How can the administration menu be hidden on certain pages?
Q: How can the administration menu be hidden on certain pages?
A: You can suppress it by simply calling the following function in PHP:
A: You can suppress it by simply calling the following function in PHP:
module_invoke('admin_menu', 'suppress');
module_invoke('admin_menu', 'suppress');
However, this needs to happen as early as possible in the page request, so
placing it in the theming layer (resp. a page template file) is too late.
Ideally, the function is called in hook_init() in a custom module. If you do
not have a custom module, placing it into some conditional code at the top of
template.php may work out, too.
However, this needs to happen as early as possible in the page request, so
placing it in the theming layer (resp. a page template file) is too late.
Ideally, the function is called in hook_init() in a custom module. If you
do not have a custom module, placing it into some conditional code at the
top of template.php may work out, too.
-- CONTACT --
Q: What does the "Administration Development Tools" module do?
A: The Administration Development Tools adds a jQuery Debugger which allows
a developer to debug and inspect arbitrary data/variables in Firebug's
console, and also to access them again in the global window object
(optionally using a named identifier, e.g. window.debug.myValue).
Chainable via jQuery. Especially useful for re-accessing and debugging
selected data via Firebug's console.
MAINTAINERS
-----------
Current maintainers:
* Daniel F. Kudwien (sun) - http://drupal.org/user/54136
* Peter Wolanin (pwolanin) - http://drupal.org/user/49851
* Stefan M. Kudwien (smk-ka) - http://drupal.org/user/48898
* Dave Reid (Dave Reid) - http://drupal.org/user/53892
* Daniel F. Kudwien (sun) - http://drupal.org/user/54136
* Peter Wolanin (pwolanin) - http://drupal.org/user/49851
* Stefan M. Kudwien (smk-ka) - http://drupal.org/user/48898
* Dave Reid (Dave Reid) - http://drupal.org/user/53892
* Truls S. Yggeseth (truls1502) - http://drupal.org/user/325866
* Sebastian Siemssen (fubhy) - https://www.drupal.org/user/761344
Major rewrite for Drupal 6 by Peter Wolanin (pwolanin).
This project has been sponsored by:
* UNLEASHED MIND
Specialized in consulting and planning of Drupal powered sites, UNLEASHED
MIND offers installation, development, theming, customization, and hosting
to get you started. Visit http://www.unleashedmind.com for more information.
* UNLEASHED MIND
Specialized in consulting and planning of Drupal powered sites, UNLEASHED
MIND offers installation, development, theming, customization, and hosting
to get you started. Visit http://www.unleashedmind.com for more information.
* Lullabot
Friendly Drupal experts providing professional consulting & education
services. Visit http://www.lullabot.com for more information.
* Acquia
Commercially Supported Drupal. Visit http://acquia.com for more information.
* Lullabot
Friendly Drupal experts providing professional consulting & education
services. Visit http://www.lullabot.com for more information.
* Acquia
Commercially Supported Drupal. Visit http://acquia.com for more information.

View File

@@ -4,9 +4,8 @@ package = Administration
core = 7.x
scripts[] = admin_devel.js
; Information added by Drupal.org packaging script on 2014-12-19
version = "7.x-3.0-rc5"
; Information added by Drupal.org packaging script on 2018-12-03
version = "7.x-3.0-rc6"
core = "7.x"
project = "admin_menu"
datestamp = "1419029284"
datestamp = "1543859284"

View File

@@ -1,4 +1,3 @@
#admin-menu {
text-align: right;
}
@@ -25,7 +24,7 @@
border-right: 0;
}
#admin-menu .dropdown .admin-menu-tab a {
border-left: 1px solid #52565E;
border-left: 1px solid #52565e;
border-right: 0;
}
#admin-menu .dropdown li li a {
@@ -42,13 +41,13 @@
/* Second-level lists */
#admin-menu .dropdown li ul {
left: auto;
right: -999em;
right: auto;
}
/* Third-and-above-level lists */
#admin-menu .dropdown li li.expandable ul {
margin-left: 0;
margin-right: 160px;
margin-left: 0 !important;
margin-right: 160px !important;
}
/* Lists nested under hovered list items */

View File

@@ -1,4 +1,8 @@
(function($) {
/**
* @file
*/
(function ($) {
/**
* Live preview of Administration menu components.
@@ -45,9 +49,9 @@ Drupal.behaviors.adminMenuPermissionsSetupHelp = {
// Figure out which is the other, check whether it still disabled,
// and if so, ask whether to auto-enable it.
var other = (this == $admin[index] ? $menu[index] : $admin[index]);
if (!other.checked && confirm(Drupal.t('Also allow !name role to !permission?', {
'!name': $roles[index].textContent,
'!permission': (this == $admin[index] ? menuPermission : adminPermission)
if (!other.checked && confirm(Drupal.t('Also allow @name role to @permission?', {
'@name': $roles[index].textContent,
'@permission': (this == $admin[index] ? menuPermission : adminPermission)
}))) {
other.checked = 'checked';
}

View File

@@ -1,4 +1,3 @@
/**
* @file
* Administration menu color override.
@@ -17,7 +16,7 @@
border-right-color: #a91f1f;
}
#admin-menu ul li.admin-menu-tab a {
border-right-color: #52565E;
border-right-color: #52565e;
}
#admin-menu li li a {
border-top-color: #801f1f;

View File

@@ -1,4 +1,3 @@
/**
* @file
* Administration menu.
@@ -16,6 +15,7 @@
position: absolute;
text-align: left;
top: 0;
height: 30px;
width: 100%;
}
#admin-menu-wrapper {
@@ -62,7 +62,7 @@ body.admin-menu {
#admin-menu li > span {
background: transparent none;
border: none;
color: #EEE;
color: #eee;
font-weight: normal;
text-align: left; /* LTR */
text-decoration: none;
@@ -74,7 +74,7 @@ body.admin-menu {
padding: 4px 8px;
}
#admin-menu .dropdown .admin-menu-tab a {
border-right: 1px solid #52565E; /* LTR */
border-right: 1px solid #52565e; /* LTR */
}
#admin-menu .dropdown li li a {
border-right: none; /* LTR */
@@ -147,7 +147,7 @@ body.admin-menu {
/* Second-and-more-level hovering */
#admin-menu .dropdown li li.expandable {
background: #45454A url(images/arrow.png) no-repeat 145px 6px;
background: #45454a url(images/arrow.png) no-repeat 145px 6px;
}
#admin-menu .dropdown li li:hover {
background-color: #111;
@@ -155,19 +155,19 @@ body.admin-menu {
#admin-menu .dropdown li li:hover a,
#admin-menu .dropdown li li:hover li:hover a,
#admin-menu .dropdown li li:hover li:hover li:hover a {
color: #FFF;
color: #fff;
}
#admin-menu .dropdown li li.expandable:hover a,
#admin-menu .dropdown li li.expandable:hover li.expandable:hover a {
border-color: #444;
color: #EEE;
color: #eee;
}
#admin-menu .dropdown li li.expandable:hover li a,
#admin-menu .dropdown li li.expandable:hover li.expandable:hover li a {
border-color: #323232;
}
#admin-menu .dropdown li li:hover li a {
color: #EEE;
color: #eee;
}
/* Search form */

View File

@@ -97,7 +97,7 @@ function admin_menu_tree_dynamic(array $expand_map) {
$db_or = db_or();
foreach ($plids as $path_plids) {
$db_and = db_and();
// plids with value 0 may be ignored.
// Plids with value 0 may be ignored.
foreach (array_filter($path_plids) as $column => $plid) {
$db_and->condition($column, $plid);
}
@@ -204,7 +204,7 @@ function admin_menu_merge_tree(array &$tree, array $tree_dynamic, array $expand_
foreach ($load_functions as $index => $function) {
if ($function) {
if (is_array($function)) {
list($function,) = each($function);
$function = key($function);
}
// Add the loader function name minus "_load".
$placeholder = '%' . substr($function, 0, -5);
@@ -269,7 +269,7 @@ function admin_menu_translate($router_item, $map) {
// replace any other.
// @todo Doing this instead leads to plenty of duplicate links below
// admin/structure/menu; likely a hidden recursion problem.
// $router_item['mlid'] = $router_item['href'] . $router_item['mlid'];
// $router_item['mlid'] = $router_item['href'] . $router_item['mlid'];.
$router_item['mlid'] = $router_item['href'];
// Turn menu callbacks into regular menu items to make them visible.
if ($router_item['type'] == MENU_CALLBACK) {
@@ -278,10 +278,12 @@ function admin_menu_translate($router_item, $map) {
// @see _menu_tree_check_access()
$key = (50000 + $router_item['weight']) . ' ' . $router_item['title'] . ' ' . $router_item['mlid'];
return array($key => array(
'link' => $router_item,
'below' => array(),
));
return array(
$key => array(
'link' => $router_item,
'below' => array(),
),
);
}
return array();
@@ -461,20 +463,22 @@ function admin_menu_links_icon() {
'#access' => user_access('display drupal links'),
'#href' => 'http://drupal.org',
);
// Add links to project issue queues.
foreach (module_list(FALSE, TRUE) as $module) {
$info = drupal_parse_info_file(drupal_get_path('module', $module) . '/' . $module . '.info');
if (!isset($info['project']) || isset($links['icon']['drupal.org'][$info['project']])) {
continue;
if (variable_get('admin_menu_issue_queues', TRUE)) {
// Add links to project issue queues.
foreach (module_list(FALSE, TRUE) as $module) {
$info = drupal_parse_info_file(drupal_get_path('module', $module) . '/' . $module . '.info');
if (!isset($info['project']) || isset($links['icon']['drupal.org'][$info['project']])) {
continue;
}
$links['icon']['drupal.org'][$info['project']] = array(
'#title' => t('@project issue queue', array('@project' => $info['name'])),
'#weight' => ($info['project'] == 'drupal' ? -10 : 0),
'#href' => 'http://drupal.org/project/issues/' . $info['project'],
'#options' => array(
'query' => array('version' => (isset($info['core']) ? $info['core'] : 'All')),
),
);
}
$links['icon']['drupal.org'][$info['project']] = array(
'#title' => t('@project issue queue', array('@project' => $info['name'])),
'#weight' => ($info['project'] == 'drupal' ? -10 : 0),
'#href' => 'http://drupal.org/project/issues/' . $info['project'],
'#options' => array(
'query' => array('version' => (isset($info['core']) ? $info['core'] : 'All')),
),
);
}
// Add items to flush caches.
$links['icon']['flush-cache'] = array(
@@ -570,7 +574,7 @@ function admin_menu_links_users() {
'#description' => t('Current anonymous / authenticated users'),
'#weight' => -90,
'#attributes' => array('class' => array('admin-menu-action', 'admin-menu-users')),
'#href' => (user_access('administer users') ? 'admin/people/people' : 'user'),
'#href' => (user_access('administer users') ? 'admin/people' : 'user'),
);
return $links;
}
@@ -658,7 +662,7 @@ function admin_menu_theme_settings() {
'#default_value' => variable_get('admin_menu_tweak_modules', 0),
);
if (module_exists('util')) {
$form['tweaks']['admin_menu_tweak_modules']['#description'] .= '<br /><strong>' . t('If the Utility module was installed for this purpose, it can be safely disabled and uninstalled.') . '</strong>';
$form['tweaks']['admin_menu_tweak_modules']['#description'] = '<br /><strong>' . t('If the Utility module was installed for this purpose, it can be safely disabled and uninstalled.') . '</strong>';
}
$form['tweaks']['admin_menu_tweak_permissions'] = array(
'#type' => 'checkbox',
@@ -685,6 +689,11 @@ function admin_menu_theme_settings() {
'#title' => t('Cache menu in client-side browser'),
'#default_value' => variable_get('admin_menu_cache_client', 1),
);
$form['performance']['admin_menu_issue_queues'] = array(
'#type' => 'checkbox',
'#title' => t('Show Issue Queue links in icon menu'),
'#default_value' => variable_get('admin_menu_issue_queues', 1),
);
return system_settings_form($form);
}
@@ -763,18 +772,20 @@ function admin_menu_flush_cache($name = NULL) {
if (!isset($caches[$name])) {
return MENU_NOT_FOUND;
}
$message = t('@title cache cleared.', array('@title' => $caches[$name]['title']));
}
else {
$caches[$name] = array(
'title' => t('Every'),
'callback' => 'drupal_flush_all_caches',
);
$message = t('All caches cleared.');
}
// Pass the cache to flush forward to the callback.
$function = $caches[$name]['callback'];
$function($name);
drupal_set_message(t('!title cache cleared.', array('!title' => $caches[$name]['title'])));
drupal_set_message($message);
// The JavaScript injects a destination request parameter pointing to the
// originating page, so the user is redirected back to that page. Without
@@ -907,4 +918,3 @@ function template_preprocess_admin_menu_icon(&$variables) {
function theme_admin_menu_icon($variables) {
return '<img class="admin-menu-icon" src="' . $variables['src'] . '" width="16" height="16" alt="' . $variables['alt'] . '" />';
}

View File

@@ -8,9 +8,8 @@ configure = admin/config/administration/admin_menu
dependencies[] = system (>7.10)
files[] = tests/admin_menu.test
; Information added by Drupal.org packaging script on 2014-12-19
version = "7.x-3.0-rc5"
; Information added by Drupal.org packaging script on 2018-12-03
version = "7.x-3.0-rc6"
core = "7.x"
project = "admin_menu"
datestamp = "1419029284"
datestamp = "1543859284"

View File

@@ -1,4 +1,8 @@
(function($) {
/**
* @file
*/
(function ($) {
Drupal.admin = Drupal.admin || {};
Drupal.admin.behaviors = Drupal.admin.behaviors || {};
@@ -139,7 +143,7 @@ Drupal.admin.getCache = function (hash, onSuccess) {
*
* @see toolbar.js
*/
Drupal.admin.height = function() {
Drupal.admin.height = function () {
var $adminMenu = $('#admin-menu');
var height = $adminMenu.outerHeight();
// In IE, Shadow filter adds some extra height, so we need to remove it from
@@ -161,7 +165,7 @@ Drupal.admin.height = function() {
Drupal.admin.attachBehaviors = function (context, settings, $adminMenu) {
if ($adminMenu.length) {
$adminMenu.addClass('admin-menu-processed');
$.each(Drupal.admin.behaviors, function() {
$.each(Drupal.admin.behaviors, function () {
this(context, settings, $adminMenu);
});
}
@@ -206,7 +210,7 @@ Drupal.admin.behaviors.replacements = function (context, settings, $adminMenu) {
*/
Drupal.admin.behaviors.destination = function (context, settings, $adminMenu) {
if (settings.admin_menu.destination) {
$('a.admin-menu-destination', $adminMenu).each(function() {
$('a.admin-menu-destination', $adminMenu).each(function () {
this.search += (!this.search.length ? '?' : '&') + Drupal.settings.admin_menu.destination;
});
}

View File

@@ -80,7 +80,14 @@ function field_ui_admin_menu_map() {
'access callback' => 'user_access',
'access arguments' => array('administer site configuration'),
);
if (!call_user_func_array($bundle_info['admin']['access callback'], $bundle_info['admin']['access arguments'])) {
$access_arguments = $bundle_info['admin']['access arguments'];
if (isset($bundle_info['admin']['real path'])) {
$menu_item = menu_get_item($bundle_info['admin']['real path']);
if (isset($menu_item['map'])) {
$access_arguments = menu_unserialize(serialize($access_arguments), $menu_item['map']);
}
}
if (!call_user_func_array($bundle_info['admin']['access callback'], $access_arguments)) {
continue;
}

View File

@@ -63,7 +63,7 @@ function admin_menu_theme() {
function admin_menu_menu() {
// AJAX callback.
// @see http://drupal.org/project/js
$items['js/admin_menu/cache'] = array(
$items['js/admin_menu/cache/%'] = array(
'page callback' => 'admin_menu_js_cache',
'delivery callback' => 'admin_menu_deliver',
'access arguments' => array('access administration menu'),
@@ -78,7 +78,7 @@ function admin_menu_menu() {
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module', 'system'),
);
$items['admin/config/administration/admin_menu'] = array(
$items['admin/config/administration/admin-menu'] = array(
'title' => 'Administration menu',
'description' => 'Adjust administration menu settings.',
'page callback' => 'drupal_get_form',
@@ -211,7 +211,7 @@ function admin_menu_page_build(&$page) {
// @todo Drupal.behaviors.adminMenuMarginTop is obsolete, but
// hook_page_build() does not allow to set a CSS class on the body yet.
// @see http://drupal.org/node/1473548, http://drupal.org/node/1194528
//$page['#attributes']['class'][] = 'admin-menu';
// $page['#attributes']['class'][] = 'admin-menu';
}
if ($setting = variable_get('admin_menu_position_fixed', 1)) {
$settings['position_fixed'] = $setting;
@@ -230,7 +230,7 @@ function admin_menu_page_build(&$page) {
if ($_GET['q'] == 'admin/modules' || strpos($_GET['q'], 'admin/modules/list') === 0) {
$settings['tweak_modules'] = variable_get('admin_menu_tweak_modules', 0);
}
if ($_GET['q'] == 'admin/people/permissions' || $_GET['q'] == 'admin/people/permissions/list') {
if (strpos($_GET['q'], 'admin/people/permissions') === 0) {
$settings['tweak_permissions'] = variable_get('admin_menu_tweak_permissions', 0);
}
@@ -502,7 +502,6 @@ function admin_menu_output($complete = FALSE) {
// @todo Move the below callbacks into hook_admin_menu_build()
// implementations (and $module.admin_menu.inc).
// Add administration menu.
if (!empty($components['admin_menu.menu']) || $complete) {
$content['menu'] = admin_menu_links_menu(admin_menu_tree('management'));
@@ -548,7 +547,10 @@ function admin_menu_output($complete = FALSE) {
// Store the new hash for this user.
if (!empty($_COOKIE['has_js']) && !$complete) {
admin_menu_cache_set($cid, md5($content));
$cache = cache_get($cid, 'cache_admin_menu');
if (!$cache || !isset($cache->data)) {
admin_menu_cache_set($cid, md5($content));
}
}
return $content;
@@ -603,11 +605,13 @@ function admin_menu_admin_menu_output_build(&$content) {
* Implements hook_admin_menu_output_alter().
*/
function admin_menu_admin_menu_output_alter(&$content) {
foreach ($content['menu'] as $key => $link) {
// Move local tasks on 'admin' into icon menu.
if ($key == 'admin/tasks' || $key == 'admin/index') {
$content['icon']['icon'][$key] = $link;
unset($content['menu'][$key]);
if (!empty($content['menu'])) {
foreach ($content['menu'] as $key => $link) {
// Move local tasks on 'admin' into icon menu.
if ($key == 'admin/tasks' || $key == 'admin/index') {
$content['icon']['icon'][$key] = $link;
unset($content['menu'][$key]);
}
}
}
}
@@ -677,6 +681,13 @@ function theme_admin_menu_links($variables) {
$elements[$path]['#options']['attributes']['class'][] = 'admin-menu-destination';
}
// If the path has an alias replace the href with the alias.
if (module_exists('path')) {
if ($alias = drupal_get_path_alias($elements[$path]['#href'])) {
$elements[$path]['#href'] = $alias;
}
}
$link = l($elements[$path]['#title'], $elements[$path]['#href'], $elements[$path]['#options']);
}
// Handle plain text items, but do not interfere with menu additions.
@@ -751,7 +762,7 @@ function admin_menu_translated_menu_link_alter(&$item, $map) {
}
}
// Don't waste cycles altering items that are not visible
// Don't waste cycles altering items that are not visible.
if (!$item['access']) {
return;
}
@@ -795,8 +806,8 @@ function admin_menu_flush_caches($uid = NULL) {
cache_clear_all($cid, 'cache_menu', TRUE);
// Flush client-side cache hashes.
drupal_static_reset('admin_menu_cache_get');
// db_table_exists() required for SimpleTest.
if (db_table_exists('cache_admin_menu')) {
// If cache_admin_menu is not empty, flush it.
if (!cache_is_empty('cache_admin_menu')) {
cache_clear_all(isset($uid) ? $cid : '*', 'cache_admin_menu', TRUE);
}
}

View File

@@ -1,4 +1,3 @@
/**
* @file
* Administration menu color override for uid1.

View File

@@ -0,0 +1,4 @@
#admin-menu > div > .dropdown > li > a,
#admin-menu > div > .dropdown > li > span {
border-left: 0;
}

View File

@@ -1,4 +1,3 @@
/**
* @file
* Toolbar style for Administration menu.
@@ -63,8 +62,9 @@ body div#toolbar.toolbar {
background: url(toolbar.png) no-repeat 0 -45px;
text-indent: -9999px;
}
#admin-menu > div > .dropdown > li > a {
border-right: 0;
#admin-menu > div > .dropdown > li > a,
#admin-menu > div > .dropdown > li > span {
border-right: 0; /* LTR */
margin-bottom: 4px;
padding: 2px 10px 3px;
}
@@ -142,4 +142,3 @@ body div#toolbar.toolbar {
#admin-menu .shortcut-toolbar a {
display: block;
}

View File

@@ -4,9 +4,8 @@ package = Administration
core = 7.x
dependencies[] = admin_menu
; Information added by Drupal.org packaging script on 2014-12-19
version = "7.x-3.0-rc5"
; Information added by Drupal.org packaging script on 2018-12-03
version = "7.x-3.0-rc6"
core = "7.x"
project = "admin_menu"
datestamp = "1419029284"
datestamp = "1543859284"

View File

@@ -34,4 +34,3 @@ function admin_menu_toolbar_update_6300() {
->condition('name', 'admin_menu_toolbar')
->execute();
}

View File

@@ -115,4 +115,3 @@ function admin_menu_toolbar_admin_menu_output_alter(&$content) {
$content['account']['account']['#options']['html'] = TRUE;
}
}

View File

@@ -16,7 +16,10 @@ class AdminMenuWebTestCase extends DrupalWebTestCase {
'admin_menu' => 'access administration menu',
);
function setUp() {
/**
*
*/
public function setUp() {
// Enable admin menu module and any other modules.
$modules = func_get_args();
$modules = isset($modules[0]) ? $modules[0] : $modules;
@@ -108,12 +111,17 @@ class AdminMenuWebTestCase extends DrupalWebTestCase {
$xpath = '//div[@id="admin-menu"]/div/ul' . implode('/parent::li/ul', $xpath);
$this->assertNoElementByXPath($xpath, $args, $message . ' link not found.');
}
}
/**
* Tests menu links depending on user permissions.
*/
class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase {
/**
*
*/
public static function getInfo() {
return array(
'name' => 'Menu link access permissions',
@@ -122,14 +130,17 @@ class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase {
);
}
function setUp() {
/**
*
*/
public function setUp() {
parent::setUp(array('node'));
}
/**
* Test that the links are added to the page (no JS testing).
*/
function testPermissions() {
public function testPermissions() {
module_enable(array('contact'));
$this->resetAll();
@@ -140,7 +151,7 @@ class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase {
// Create a user who
// - can access content overview
// - cannot access drupal.org links
// - cannot administer Contact module
// - cannot administer Contact module.
$permissions = $this->basePermissions + array(
'access content overview',
);
@@ -156,7 +167,7 @@ class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase {
// Create a user "reversed" to the above; i.e., who
// - cannot access content overview
// - can access drupal.org links
// - can administer Contact module
// - can administer Contact module.
$permissions = $this->basePermissions + array(
'display drupal links',
'administer contact forms',
@@ -172,7 +183,7 @@ class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase {
/**
* Tests handling of links pointing to category/overview pages.
*/
function testCategories() {
public function testCategories() {
// Create a user with minimum permissions.
$admin_user = $this->drupalCreateUser($this->basePermissions);
$this->drupalLogin($admin_user);
@@ -201,7 +212,7 @@ class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase {
/**
* Tests that user role and permission changes are properly taken up.
*/
function testPermissionChanges() {
public function testPermissionChanges() {
// Create a user who is able to change permissions.
$permissions = $this->basePermissions + array(
'administer permissions',
@@ -253,12 +264,17 @@ class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase {
// Verify that Structure » Content types does not appear.
$this->assertNoLinkTrailByTitle(array(t('Structure'), t('Content types')));
}
}
/**
* Tests appearance, localization, and escaping of dynamic links.
*/
class AdminMenuDynamicLinksTestCase extends AdminMenuWebTestCase {
/**
*
*/
public static function getInfo() {
return array(
'name' => 'Dynamic links',
@@ -267,14 +283,17 @@ class AdminMenuDynamicLinksTestCase extends AdminMenuWebTestCase {
);
}
function setUp() {
/**
*
*/
public function setUp() {
parent::setUp(array('node'));
}
/**
* Tests node type links.
*/
function testNode() {
public function testNode() {
$type = $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
// Create a content-type with special characters.
$type = $this->drupalCreateContentType(array('type' => 'special', 'name' => 'Cool & Special'));
@@ -324,7 +343,7 @@ class AdminMenuDynamicLinksTestCase extends AdminMenuWebTestCase {
/**
* Tests Add content links.
*/
function testNodeAdd() {
public function testNodeAdd() {
$type = $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
// Verify that "Add content" does not appear for unprivileged users.
@@ -359,12 +378,17 @@ class AdminMenuDynamicLinksTestCase extends AdminMenuWebTestCase {
t('Add content'),
));
}
}
/**
* Tests appearance of different types of links.
*/
class AdminMenuLinkTypesTestCase extends AdminMenuWebTestCase {
/**
*
*/
public static function getInfo() {
return array(
'name' => 'Link types',
@@ -373,7 +397,10 @@ class AdminMenuLinkTypesTestCase extends AdminMenuWebTestCase {
);
}
function setUp() {
/**
*
*/
public function setUp() {
parent::setUp(array('help'));
$permissions = module_invoke_all('permission');
@@ -385,7 +412,7 @@ class AdminMenuLinkTypesTestCase extends AdminMenuWebTestCase {
/**
* Tests appearance of different router item link types.
*/
function testLinkTypes() {
public function testLinkTypes() {
// Verify that MENU_NORMAL_ITEMs appear.
$this->assertLinkTrailByTitle(array(
t('Configuration'),
@@ -420,12 +447,17 @@ class AdminMenuLinkTypesTestCase extends AdminMenuWebTestCase {
':title' => t('Index'),
), "Icon » Index link found.");
}
}
/**
* Tests customized menu links.
*/
class AdminMenuCustomizedTestCase extends AdminMenuWebTestCase {
/**
*
*/
public static function getInfo() {
return array(
'name' => 'Customized links',
@@ -434,7 +466,10 @@ class AdminMenuCustomizedTestCase extends AdminMenuWebTestCase {
);
}
function setUp() {
/**
*
*/
public function setUp() {
parent::setUp(array('menu'));
$this->admin_user = $this->drupalCreateUser($this->basePermissions + array(
@@ -446,7 +481,7 @@ class AdminMenuCustomizedTestCase extends AdminMenuWebTestCase {
/**
* Test disabled custom links.
*/
function testCustomDisabled() {
public function testCustomDisabled() {
$type = $this->drupalCreateContentType();
$node = $this->drupalCreateNode(array('type' => $type->type));
$text = $this->randomName();
@@ -488,7 +523,7 @@ class AdminMenuCustomizedTestCase extends AdminMenuWebTestCase {
/**
* Tests external links.
*/
function testCustomExternal() {
public function testCustomExternal() {
// Add a custom link to the node to the menu.
$edit = array(
'link_path' => 'http://example.com',
@@ -516,5 +551,5 @@ class AdminMenuCustomizedTestCase extends AdminMenuWebTestCase {
':path' => $path,
))->fetchField();
}
}
}