summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalvis2018-04-17 23:17:41 (GMT)
committersalvis2018-04-17 23:17:41 (GMT)
commitcbc82b72e4c251c925b790a4e5953a5a317bf759 (patch)
tree502e5d00aeacb6d6350d1135eea3ed3f182be4f8
parent7fe21b294162796a60225f9d12283d618100a960 (diff)
Issue #541342 by zorya, salvis: Display message about Devel block missing because Menu is not enabled.7.x-1.67.x-1.x
-rw-r--r--devel.admin.inc32
1 files changed, 32 insertions, 0 deletions
diff --git a/devel.admin.inc b/devel.admin.inc
index 0b75b0a..cecdb38 100644
--- a/devel.admin.inc
+++ b/devel.admin.inc
@@ -11,6 +11,8 @@
* @ingroup forms
*/
function devel_admin_settings() {
+ _devel_display_block_help_message();
+
$form['queries'] = array('#type' => 'fieldset', '#title' => t('Query log'));
$description = t('Display a log of the database queries needed to generate the current page, and the execution time for each. Also, queries which are repeated during a single page view are summed in the # column, and printed in red since they are candidates for caching.');
@@ -134,6 +136,36 @@ function devel_admin_settings() {
}
/**
+ * Displays a helpful message if Menu module is not installed.
+ */
+function _devel_display_block_help_message() {
+ if (!module_exists('menu')) {
+ $devel_block_alert = t('Devel block alert: The Devel block requires the Core Menu module. The Devel block will become available once you <a href="!url">enable Menu</a>.',
+ array('!url' => url('admin/modules'))
+ );
+ $variables = array(
+ '!admin_menu_url' => url('https://drupal.org/project/admin_menu', array('external' => TRUE)),
+ '!admin_menu_name' => 'Administration Menu',
+ '!admin_menu_config_url' => url('admin/config/administration/admin_menu'),
+ '!icon_menu' => t('Icon menu'),
+ );
+ if (!module_exists('admin_menu')) {
+ $devel_block_alert .= '<br />' . t('Alternatively, you can install <a href="!admin_menu_url">!admin_menu_name</a> which supports displaying the Devel menu items in its !icon_menu.', $variables);
+ }
+ else {
+ $admin_menu_components = variable_get('admin_menu_components', array());
+ if (empty($admin_menu_components['admin_menu.icon']) || !user_access('access administration menu')) {
+ $devel_block_alert .= '<br />' . t("Alternatively, if you <a href='!admin_menu_config_url'>enable !admin_menu_name's !icon_menu</a> you will find the Devel menu items there.", $variables);
+ } else {
+ // Don't bother with a message in the 'normal' case.
+ return;
+ }
+ }
+ drupal_set_message($devel_block_alert, 'warning');
+ }
+}
+
+/**
* Demonstrates the active error handler.
*
* Generates some warnings or errors so that the reaction of the current error