admin_devel.module in Administration menu 8.3
Same filename and directory in other branches
Administration and debugging functionality for developers and site builders.
File
admin_devel/admin_devel.moduleView source
<?php
/**
* @file
* Administration and debugging functionality for developers and site builders.
*/
/**
* Implements hook_page_build().
*/
function admin_devel_page_build(&$page) {
$page['#attached']['js'][] = drupal_get_path('module', 'admin_devel') . '/admin_devel.js';
}
/**
* Implements hook_form_FORMID_alter().
*/
function admin_devel_form_admin_menu_admin_settings_form_alter(&$form, &$form_state) {
$form['actions']['wipe_rebuild'] = [
'#type' => 'submit',
'#value' => t('Rebuild system links'),
'#submit' => [
'admin_devel_form_admin_menu_admin_settings_form_alter_rebuild_submit',
],
// @todo Not necessarily ready for mass-consumption yet.
'#access' => FALSE,
];
}
/**
* Form submit handler to wipe and rebuild all 'module' = 'system' menu links.
*/
function admin_devel_form_admin_menu_admin_settings_form_alter_rebuild_submit($form, &$form_state) {
// Delete all auto-generated menu links derived from menu router items.
$connection = Database::getConnection();
$connection
->delete('menu_links')
->condition('module', 'system')
->execute();
// Rebuild menu links from current menu router items.
menu_router_rebuild();
\Drupal::messenger()
->addStatus(t('System links derived from menu router paths have been rebuilt.'));
}
/**
* Implements hook_admin_menu_cache_info() on behalf of Simpletest module.
*/
function simpletest_admin_menu_cache_info() {
$caches['simpletest'] = [
'title' => t('Test classes'),
'callback' => '_admin_devel_simpletest_cache_clear',
];
return $caches;
}
function _admin_devel_simpletest_cache_clear() {
cache()
->delete('simpletest');
}
Functions
Name | Description |
---|---|
admin_devel_form_admin_menu_admin_settings_form_alter | Implements hook_form_FORMID_alter(). |
admin_devel_form_admin_menu_admin_settings_form_alter_rebuild_submit | Form submit handler to wipe and rebuild all 'module' = 'system' menu links. |
admin_devel_page_build | Implements hook_page_build(). |
simpletest_admin_menu_cache_info | Implements hook_admin_menu_cache_info() on behalf of Simpletest module. |
_admin_devel_simpletest_cache_clear |