Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -1,45 +1,62 @@
---SUMMARY---
CONTENTS OF THIS FILE
---------------------
* Introduction
* Requirements
* Recommended modules
* Installation
* Configuration
* Maintainers
INTRODUCTION
------------
Admin Toolbar Extra Tools provides menu links to administration pages or actions
(eg. Flushing caches) that are not generated by Drupal core. It adds menu items
that are not generated by Drupal core. For example there are no menu items for
each content type by default or menu links to Manage fields on each entity types.
That's the purpose of Admin Toolbar Extra Tools to add them.
each content type by default or menu links to Manage fields on each entity
types. That's the purpose of Admin Toolbar Extra Tools to add them.
For a full description visit project page:
https://www.drupal.org/project/admin_toolbar
* For a full description of the module, visit the project page:
https://www.drupal.org/project/admin_toolbar
Bug reports, feature suggestions and latest developments:
http://drupal.org/project/issues/admin_toolbar
* To submit bug reports and feature suggestions, or to track changes:
https://www.drupal.org/project/issues/search/admin_toolbar
---REQUIREMENTS---
REQUIREMENTS
------------
*Admin Toolbar.
This module requires the following modules:
* Admin Toolbar (https://www.drupal.org/project/admin_toolbar)
---INSTALLATION---
INSTALLATION
------------
Install as usual.
Place the entirety of this directory in the /modules folder of your Drupal
installation. Navigate to Administer > Extend. Check the 'Enabled' box next
'Admin toolbar Extra Tools' and then click the 'Save Configuration' button at
the bottom.
For help regarding installation, visit:
https://www.drupal.org/documentation/install/modules-themes/modules-8
* Install as you would normally install a contributed Drupal module.
See: https://www.drupal.org/node/895232 for further information.
---CONTACT---
CONFIGURATION
-------------
Current Maintainers:
*Wilfrid Roze (eme) - https://www.drupal.org/u/eme
*Mohamed Anis Taktak (matio89) - https://www.drupal.org/u/matio89
No configuration is needed.
MAINTAINERS
-----------
Current maintainers:
* Wilfrid Roze (eme) - https://www.drupal.org/u/eme
* Romain Jarraud (romainj) - https://www.drupal.org/u/romainj
* Adrian Cid Almaguer (adriancid) - https://www.drupal.org/u/adriancid
* Mohamed Anis Taktak (matio89) - https://www.drupal.org/u/matio89
This project has been sponsored by:
*emerya
Founded in 2009, emerya is a human-sized company, dedicated to the design and
implementation of web interfaces.
Visit: http://http://emerya.fr/ for more information.
* emerya
Founded in 2009, emerya is a human-sized company, dedicated to the design and
implementation of web interfaces. Visit: http://http://emerya.fr/ for more
information.

View file

@ -1,13 +1,16 @@
name: Admin Toolbar Extra Tools
# core: 8.x
description: Adds menu links to the Admin Toolbar.
package: Administration
type: module
dependencies:
- admin_toolbar
# Information added by Drupal.org packaging script on 2016-12-01
version: '8.x-1.18'
type: module
# core: 8.x
dependencies:
- admin_toolbar:admin_toolbar
- drupal:system (>=8.5)
# Information added by Drupal.org packaging script on 2018-11-22
version: '8.x-1.25'
core: '8.x'
project: 'admin_toolbar'
datestamp: 1480614186
datestamp: 1542915184

View file

@ -63,29 +63,14 @@ admin_toolbar_tools.flush_menu:
parent: admin_toolbar_tools.flush
menu_name: admin
admin_toolbar_tools.flush_twig:
title: 'Flush twig cache'
route_name: admin_toolbar_tools.flush_twig
parent: admin_toolbar_tools.flush
menu_name: admin
admin_toolbar_tools.flush_rendercache:
title: 'Flush render cache'
route_name: admin_toolbar_tools.flush_rendercache
parent: admin_toolbar_tools.flush
menu_name: admin
admin_toolbar_tools.drupalorg:
title: 'Drupal.org'
weight: -5
route_name: admin_toolbar_tools.drupalorg
parent: admin_toolbar_tools.help
menu_name: admin
admin_toolbar_tools.listchanges:
title: 'Change records for Drupal core'
weight: -6
route_name: admin_toolbar_tools.listchanges
parent: admin_toolbar_tools.drupalorg
menu_name: admin
admin_toolbar_tools.doc:
title: 'D8 API documentation'
weight: -5
route_name: admin_toolbar_tools.doc
parent: admin_toolbar_tools.drupalorg
menu_name: admin

View file

@ -6,67 +6,90 @@
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
/**
* Implements hook_toolbar().
*/
function admin_toolbar_tools_toolbar() {
$items = array();
$items['admin_toolbar_tools'] = array(
$items = [];
$items['admin_toolbar_tools'] = [
'#type' => 'toolbar_item',
'tab' => array(
'tab' => [
'#type' => 'link',
'#attributes' => array(
'class' => array('toolbar-icon', 'toolbar-icon-admin-toolbar-tools-help'),
),
),
'#attached' => array('library' => array('admin_toolbar_tools/toolbar.icon'),
),
);
'#attributes' => [
'class' => ['toolbar-icon', 'toolbar-icon-admin-toolbar-tools-help'],
],
],
'#attached' => ['library' => ['admin_toolbar_tools/toolbar.icon']],
];
return $items;
}
/**
* Implements hook_help().
* Implements hook_help().
*/
function admin_toolbar_tools_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.admin_toolbar_tools':
$output = '';
$output .= '<p>' . t('The Admin Toolbar Extra Tools module comes packaged with the <a href="https://www.drupal.org/project/admin_toolbar"> Admin Toolbar</a> module and adds functionality to it. The additional functionality is accessed thru extra links on the main administration <a href="https://www.drupal.org/project/toolbar">Toolbar</a>. Some links to Admin Toolbar Extra Tools administration pages are located at the bottom of this page. For more information, see the <a href="https://www.drupal.org/node/2713693">online documentation for Admin Toolbar</a>') . '</p>';
$output .= '<p>';
$output .= t('The Admin Toolbar Extra Tools module comes packaged with the <a href=":admin-toolbar">Admin Toolbar</a> module and adds functionality to it. The additional functionality is accessed thru extra links on the main administration Toolbar. Some links to Admin Toolbar Extra Tools administration pages are located at the bottom of this page.</a>', [':admin-toolbar' => Url::fromRoute('help.page', ['name' => 'admin_toolbar'])->toString()]);
$output .= '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<p>' . t('To use Admin Toolbar Extra Tools just install it like any other module. There is no other configuration required. The Admin Toolbar functionality can be further extended by installing complimentary modules. See <a href="https://www.drupal.org/project/admin_toolbar">Admin Toolbar</a> for a complete listing of these complimentary modules.') . '</p>';
$output .= '<p>' . t('To use Admin Toolbar Extra Tools just install it like any other module. There is no other configuration required.') . '</p>';
return $output;
}
}
/**
* Implements hook_menu_links_discovered_alter().
* Implements hook_menu_links_discovered_alter().
*/
function admin_toolbar_tools_menu_links_discovered_alter(&$links) {
$moduleHandler = \Drupal::moduleHandler();
$entityTypeManager = \Drupal::entityTypeManager();
$routeProvider = \Drupal::service('router.route_provider');
$routes = array();
$routes = [];
foreach ($routeProvider->getAllRoutes() as $route_name => $route) {
$routes[] = $route_name;
}
$entityTypes = $entityTypeManager->getDefinitions();
$content_entities = array();
$content_entities = [];
foreach ($entityTypes as $key => $entityType) {
if ($entityType->getBundleEntityType() && ($entityType->get('field_ui_base_route') != '')) {
$content_entities[$key] = array(
$content_entities[$key] = [
'content_entity' => $key,
'content_entity_bundle' => $entityType->getBundleEntityType(),
);
];
}
}
// Adding a menu link to clean the Views cache.
if ($moduleHandler->moduleExists('views')) {
$links['admin_toolbar_tools.flush_views'] = [
'title' => t('Flush views cache'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'admin_toolbar_tools.flush_views',
'menu_name' => 'admin',
'parent' => 'admin_toolbar_tools.flush',
];
// Adding a menu link to Files.
if ($moduleHandler->moduleExists('file') && in_array('view.files.page_1', $routes)) {
$links['admin_toolbar_tools.view.files'] = [
'title' => t('Files'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'view.files.page_1',
'menu_name' => 'admin',
'parent' => 'system.admin_content',
];
}
}
// Adds common links to entities.
foreach ($content_entities as $module_name => $entities) {
foreach ($content_entities as $entities) {
$content_entity_bundle = $entities['content_entity_bundle'];
$content_entity = $entities['content_entity'];
foreach ($entityTypeManager->getStorage($content_entity_bundle)->loadMultiple() as $machine_name => $bundle) {
@ -75,23 +98,25 @@ function admin_toolbar_tools_menu_links_discovered_alter(&$links) {
if (in_array('entity.' . $content_entity_bundle . '.overview_form', $routes)) {
// Some bundles have an overview/list form that make a better root link.
$content_entity_bundle_root = 'entity.' . $content_entity_bundle . '.overview_form.' . $machine_name;
$links[$content_entity_bundle_root] = array(
'title' => $bundle->label(),
$links[$content_entity_bundle_root] = [
'title' => t($bundle->label()),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.' . $content_entity_bundle . '.overview_form',
'menu_name' => 'admin',
'parent' => 'entity.' . $content_entity_bundle . '.collection',
'route_parameters' => array($content_entity_bundle => $machine_name),
);
'route_parameters' => [$content_entity_bundle => $machine_name],
];
}
if (in_array('entity.' . $content_entity_bundle . '.edit_form', $routes)) {
$key = 'entity.' . $content_entity_bundle . '.edit_form.' . $machine_name;
$links[$key] = array(
'title' => $bundle->label(),
$links[$key] = [
'title' => t($bundle->label()),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.' . $content_entity_bundle . '.edit_form',
'menu_name' => 'admin',
'parent' => 'entity.' . $content_entity_bundle . '.collection',
'route_parameters' => array($content_entity_bundle => $machine_name),
);
'route_parameters' => [$content_entity_bundle => $machine_name],
];
if (empty($content_entity_bundle_root)) {
$content_entity_bundle_root = $key;
}
@ -102,420 +127,551 @@ function admin_toolbar_tools_menu_links_discovered_alter(&$links) {
}
if ($moduleHandler->moduleExists('field_ui')) {
if (in_array('entity.' . $content_entity . '.field_ui_fields', $routes)) {
$links['entity.' . $content_entity . '.field_ui_fields' . $machine_name] = array(
$links['entity.' . $content_entity . '.field_ui_fields' . $machine_name] = [
'title' => t('Manage fields'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.' . $content_entity . '.field_ui_fields',
'menu_name' => 'admin',
'parent' => $content_entity_bundle_root,
'route_parameters' => array($content_entity_bundle => $machine_name),
'route_parameters' => [$content_entity_bundle => $machine_name],
'weight' => 1,
);
];
}
if (in_array('entity.entity_form_display.' . $content_entity . '.default', $routes)) {
$links['entity.entity_form_display.' . $content_entity . '.default' . $machine_name] = array(
$links['entity.entity_form_display.' . $content_entity . '.default' . $machine_name] = [
'title' => t('Manage form display'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.entity_form_display.' . $content_entity . '.default',
'menu_name' => 'admin',
'parent' => $content_entity_bundle_root,
'route_parameters' => array($content_entity_bundle => $machine_name),
'route_parameters' => [$content_entity_bundle => $machine_name],
'weight' => 2,
);
];
}
if (in_array('entity.entity_view_display.' . $content_entity . '.default', $routes)) {
$links['entity.entity_view_display.' . $content_entity . '.default.' . $machine_name] = array(
$links['entity.entity_view_display.' . $content_entity . '.default.' . $machine_name] = [
'title' => t('Manage display'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.entity_view_display.' . $content_entity . '.default',
'menu_name' => 'admin',
'parent' => $content_entity_bundle_root,
'route_parameters' => array($content_entity_bundle => $machine_name),
'route_parameters' => [$content_entity_bundle => $machine_name],
'weight' => 3,
);
];
}
}
if ($moduleHandler->moduleExists('devel') && in_array('entity.' . $content_entity_bundle . '.devel_load', $routes)) {
$links['entity.' . $content_entity_bundle . '.devel_load.' . $machine_name] = array(
$links['entity.' . $content_entity_bundle . '.devel_load.' . $machine_name] = [
'title' => t('Devel'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.' . $content_entity_bundle . '.devel_load',
'menu_name' => 'admin',
'parent' => $content_entity_bundle_root,
'route_parameters' => array($content_entity_bundle => $machine_name),
'route_parameters' => [$content_entity_bundle => $machine_name],
'weight' => 4,
);
];
}
if (in_array('entity.' . $content_entity_bundle . '.delete_form', $routes)) {
$links['entity.' . $content_entity_bundle . '.delete_form.' . $machine_name] = array(
$links['entity.' . $content_entity_bundle . '.delete_form.' . $machine_name] = [
'title' => t('Delete'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.' . $content_entity_bundle . '.delete_form',
'menu_name' => 'admin',
'parent' => $content_entity_bundle_root,
'route_parameters' => array($content_entity_bundle => $machine_name),
'route_parameters' => [$content_entity_bundle => $machine_name],
'weight' => 5,
);
];
}
}
}
// Add user links.
$links['user.admin_create'] = array(
$links['user.admin_create'] = [
'title' => t('Add a new user'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'user.admin_create',
'menu_name' => 'admin',
'parent' => 'entity.user.collection',
);
$links['user.admin_permissions'] = array(
];
$links['user.admin_permissions'] = [
'title' => t('Permissions'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'user.admin_permissions',
'menu_name' => 'admin',
'parent' => 'entity.user.collection',
);
$links['entity.user_role.collection'] = array(
];
$links['entity.user_role.collection'] = [
'title' => t('Roles'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.user_role.collection',
'menu_name' => 'admin',
'parent' => 'entity.user.collection',
);
$links['user.role_add'] = array(
];
$links['admin_toolbar_tools.user.logout'] = [
'title' => t('Logout'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'user.logout',
'parent' => 'admin_toolbar_tools.help',
'weight' => 10,
];
$links['user.role_add'] = [
'title' => t('Add a new role'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'user.role_add',
'menu_name' => 'admin',
'parent' => 'entity.user_role.collection',
'weight' => -5,
);
];
if ($moduleHandler->moduleExists('field_ui')) {
$links['entity.user.field_ui_fields_'] = array(
$links['entity.user.field_ui_fields_'] = [
'title' => t('Manage fields'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.user.field_ui_fields',
'menu_name' => 'admin',
'parent' => 'entity.user.admin_form',
);
$links['entity.entity_form_display.user.default_'] = array(
];
$links['entity.entity_form_display.user.default_'] = [
'title' => t('Manage form display'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.entity_form_display.user.default',
'menu_name' => 'admin',
'parent' => 'entity.user.admin_form',
);
$links['entity.entity_view_display.user.default_'] = array(
];
$links['entity.entity_view_display.user.default_'] = [
'title' => t('Manage display'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.entity_view_display.user.default',
'menu_name' => 'admin',
'parent' => 'entity.user.admin_form',
);
];
}
foreach (user_roles() as $role) {
$links['entity.user_role.edit_form.' . $role->id()] = array(
'title' => $role->label(),
$links['entity.user_role.edit_form.' . $role->id()] = [
'title' => t($role->label()),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.user_role.edit_form',
'menu_name' => 'admin',
'parent' => 'entity.user_role.collection',
'route_parameters' => array('user_role' => $role->id()),
);
$links['entity.user_role.edit_permissions_form.' . $role->id()] = array(
'route_parameters' => ['user_role' => $role->id()],
];
$links['entity.user_role.edit_permissions_form.' . $role->id()] = [
'title' => t('Edit permissions'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.user_role.edit_permissions_form',
'menu_name' => 'admin',
'parent' => 'entity.user_role.edit_form.' . $role->id(),
'route_parameters' => array('user_role' => $role->id()),
);
$links['entity.user_role.delete_form.' . $role->id()] = array(
'route_parameters' => ['user_role' => $role->id()],
];
$links['entity.user_role.delete_form.' . $role->id()] = [
'title' => t('Delete'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.user_role.delete_form',
'menu_name' => 'admin',
'parent' => 'entity.user_role.edit_form.' . $role->id(),
'route_parameters' => array('user_role' => $role->id()),
);
'route_parameters' => ['user_role' => $role->id()],
];
if ($moduleHandler->moduleExists('devel')) {
$links['entity.user_role.devel_load.' . $role->id()] = array(
$links['entity.user_role.devel_load.' . $role->id()] = [
'title' => t('Devel'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.user_role.devel_load',
'menu_name' => 'admin',
'parent' => 'entity.user_role.edit_form.' . $role->id(),
'route_parameters' => array('user_role' => $role->id()),
);
'route_parameters' => ['user_role' => $role->id()],
];
}
}
if ($moduleHandler->moduleExists('node')) {
$links['node.add_page']['parent'] = 'system.admin_content';
$links['node.type_add'] = array(
$links['admin_toolbar_tools.add_content'] = $links['node.add_page'];
$links['admin_toolbar_tools.add_content']['parent'] = 'system.admin_content';
$links['node.type_add'] = [
'title' => t('Add content type'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'node.type_add',
'menu_name' => 'admin',
'parent' => 'entity.node_type.collection',
'weight' => -5
);
'weight' => -5,
];
// Add node links for each content type.
foreach (node_type_get_names() as $machine_name => $label) {
$links['node.add.' . $machine_name] = array(
'title' => $label,
foreach ($entityTypeManager->getStorage('node_type')->loadMultiple() as $type) {
$links['node.add.' . $type->id()] = [
'title' => t($type->label()),
'provider' => 'admin_toolbar_tools',
'route_name' => 'node.add',
'menu_name' => 'admin',
'parent' => 'node.add_page',
'route_parameters' => array('node_type' => $machine_name),
);
'parent' => 'admin_toolbar_tools.add_content',
'route_parameters' => ['node_type' => $type->id()],
];
}
}
if ($moduleHandler->moduleExists('field_ui')) {
$links['field_ui.entity_form_mode_add'] = array(
$links['field_ui.entity_form_mode_add'] = [
'title' => t('Add new form mode'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'field_ui.entity_form_mode_add',
'menu_name' => 'admin',
'parent' => 'entity.entity_form_mode.collection',
);
$links['field_ui.entity_view_mode_add'] = array(
];
$links['field_ui.entity_view_mode_add'] = [
'title' => t('Add new view mode'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'field_ui.entity_view_mode_add',
'menu_name' => 'admin',
'parent' => 'entity.entity_view_mode.collection',
);
];
}
if ($moduleHandler->moduleExists('taxonomy')) {
$links['entity.taxonomy_vocabulary.add_form'] = array(
$links['entity.taxonomy_vocabulary.add_form'] = [
'title' => t('Add vocabulary'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.taxonomy_vocabulary.add_form',
'menu_name' => 'admin',
'parent' => 'entity.taxonomy_vocabulary.collection',
'weight' => -5,
);
];
}
if ($moduleHandler->moduleExists('menu_ui')) {
$links['entity.menu.add_form'] = array(
$links['entity.menu.add_form'] = [
'title' => t('Add menu'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.menu.add_form',
'menu_name' => 'admin',
'parent' => 'entity.menu.collection',
'weight' => -50
);
'weight' => -50,
];
// Adds links to /admin/structure/menu.
foreach (menu_ui_get_menus() as $machine_name => $label) {
$links['entity.menu.edit_form.' . $machine_name] = array(
'title' => $label,
$links['entity.menu.edit_form.' . $machine_name] = [
'title' => t($label),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.menu.edit_form',
'menu_name' => 'admin',
'parent' => 'entity.menu.collection',
'route_parameters' => array('menu' => $machine_name),
);
$links['entity.menu.delete_form.' . $machine_name] = array(
'route_parameters' => ['menu' => $machine_name],
];
$links['entity.menu.delete_form.' . $machine_name] = [
'title' => t('Delete'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.menu.delete_form',
'menu_name' => 'admin',
'parent' => 'entity.menu.edit_form.' . $machine_name,
'route_parameters' => array('menu' => $machine_name),
);
'route_parameters' => ['menu' => $machine_name],
];
if ($moduleHandler->moduleExists('devel')) {
$links['entity.menu.devel_load.' . $machine_name] = array(
$links['entity.menu.devel_load.' . $machine_name] = [
'title' => t('Devel'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.menu.devel_load',
'menu_name' => 'admin',
'parent' => 'entity.menu.edit_form.' . $machine_name,
'route_parameters' => array('menu' => $machine_name),
);
'route_parameters' => ['menu' => $machine_name],
];
}
$links['entity.menu.add_link_form.' . $machine_name] = array(
$links['entity.menu.add_link_form.' . $machine_name] = [
'title' => t('Add link'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.menu.add_link_form',
'menu_name' => 'admin',
'parent' => 'entity.menu.edit_form.' . $machine_name,
'route_parameters' => array('menu' => $machine_name),
);
'route_parameters' => ['menu' => $machine_name],
];
}
}
// If module block_content is enabled.
if ($moduleHandler->moduleExists('block_content')) {
$links['block_content.add_page'] = array(
$links['block_content.add_page'] = [
'title' => t('Add custom block'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'block_content.add_page',
'menu_name' => 'admin',
'parent' => 'block.admin_display',
'weight' => -100
);
$links['entity.block_content.collection'] = array(
'weight' => -100,
];
$links['entity.block_content.collection'] = [
'title' => t('Custom block library'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.block_content.collection',
'menu_name' => 'admin',
'parent' => 'block.admin_display',
);
$links['entity.block_content_type.collection'] = array(
];
$links['entity.block_content_type.collection'] = [
'title' => t('Types'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.block_content_type.collection',
'menu_name' => 'admin',
'parent' => 'block.admin_display',
);
];
}
// If module Contact is enabled.
if ($moduleHandler->moduleExists('contact')) {
$links['contact.form_add'] = array(
$links['contact.form_add'] = [
'title' => t('Add contact form'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'contact.form_add',
'menu_name' => 'admin',
'parent' => 'entity.contact_form.collection',
'weight' => -5
);
'weight' => -5,
];
}
// If module Update Manager is enabled.
if ($moduleHandler->moduleExists('update')) {
$links['update.module_update'] = array(
$links['update.module_update'] = [
'title' => t('Update'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'update.module_update',
'menu_name' => 'admin',
'parent' => 'system.modules_list',
);
$links['update.module_install'] = array(
];
$links['update.module_install'] = [
'title' => t('Install new module'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'update.module_install',
'menu_name' => 'admin',
'parent' => 'system.modules_list',
);
];
}
// If module Devel is enabled.
if ($moduleHandler->moduleExists('devel')) {
$links['admin_development'] = array(
$links['admin_development'] = [
'title' => t('Development'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'system.admin_config_development',
'menu_name' => 'admin',
'parent' => 'admin_toolbar_tools.help',
'weight' => '-8',
);
$links['admin_toolbar_tools.devel.admin_settings'] = array(
];
$links['admin_toolbar_tools.devel.admin_settings'] = [
'title' => t('Devel settings'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'devel.admin_settings',
'menu_name' => 'admin',
'parent' => 'admin_development',
'weight' => '-1',
);
$links['admin_toolbar_tools.devel.configs_list'] = array(
];
if ($moduleHandler->moduleExists('webprofiler')) {
$links['admin_toolbar_tools.devel.webprofiler'] = [
'title' => t('Web Profiler settings'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'webprofiler.settings',
'menu_name' => 'admin',
'parent' => 'admin_development',
];
}
$links['admin_toolbar_tools.devel.configs_list'] = [
'title' => t('Config editor'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'devel.configs_list',
'menu_name' => 'admin',
'parent' => 'admin_development',
);
$links['admin_toolbar_tools.devel.reinstall'] = array(
];
$links['admin_toolbar_tools.devel.reinstall'] = [
'title' => t('Reinstall modules'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'devel.reinstall',
'parent' => 'admin_development',
);
$links['admin_toolbar_tools.devel.menu_rebuild'] = array(
];
$links['admin_toolbar_tools.devel.menu_rebuild'] = [
'title' => t('Rebuild menu'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'devel.menu_rebuild',
'menu_name' => 'admin',
'parent' => 'admin_development',
);
$links['admin_toolbar_tools.devel.state_system_page'] = array(
];
$links['admin_toolbar_tools.devel.state_system_page'] = [
'title' => t('State editor'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'devel.state_system_page',
'menu_name' => 'admin',
'parent' => 'admin_development',
);
$links['admin_toolbar_tools.devel.theme_registry'] = array(
];
$links['admin_toolbar_tools.devel.theme_registry'] = [
'title' => t('Theme registry'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'devel.theme_registry',
'menu_name' => 'admin',
'parent' => 'admin_development',
);
$links['admin_toolbar_tools.devel.entity_info_page'] = array(
];
$links['admin_toolbar_tools.devel.entity_info_page'] = [
'title' => t('Entity Info'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'devel.entity_info_page',
'menu_name' => 'admin',
'parent' => 'admin_development',
);
$links['admin_toolbar_tools.devel.execute_php'] = array(
];
$links['admin_toolbar_tools.devel.execute_php'] = [
'title' => t('Execute PHP Code'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'devel.execute_php',
'menu_name' => 'admin',
'parent' => 'admin_development',
);
$links['admin_toolbar_tools.devel.session'] = array(
];
$links['admin_toolbar_tools.devel.session'] = [
'title' => t('Session viewer'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'devel.session',
'menu_name' => 'admin',
'parent' => 'admin_development',
);
$links['admin_toolbar_tools.devel.elements_page'] = array(
];
$links['admin_toolbar_tools.devel.elements_page'] = [
'title' => t('Form API field types'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'devel.elements_page',
'menu_name' => 'admin',
'parent' => 'admin_development',
);
];
// Menu link for the Toolbar module.
$links['admin_toolbar_tools.toolbar.settings'] = [
'title' => t('Toolbar settings'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'devel.toolbar.settings_form',
'menu_name' => 'admin',
'parent' => 'devel.admin_settings',
];
}
// If module Views Ui enabled.
if ($moduleHandler->moduleExists('views_ui')) {
$links['views_ui.add'] = array(
$links['admin_toolbar_tools.views_ui.add'] = [
'title' => t('Add new view'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'views_ui.add',
'menu_name' => 'admin',
'parent' => 'entity.view.collection',
'weight' => -5,
);
];
$links['admin_toolbar_tools.views_ui.field_list'] = [
'title' => t('Used in views'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'views_ui.reports_fields',
'menu_name' => 'admin',
'parent' => 'entity.field_storage_config.collection',
];
}
$links['system.theme_settings_'] = array(
$links['admin_toolbar_tools.system.theme_settings'] = [
'title' => t('Settings'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'system.theme_settings',
'menu_name' => 'admin',
'parent' => 'system.themes_page',
);
];
if ($moduleHandler->moduleExists('webprofiler')) {
$links['admin_toolbar_tools.devel.webprofiler'] = [
'title' => t('Webprofiler settings'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'webprofiler.settings',
'menu_name' => 'admin',
'parent' => 'admin_development',
];
}
if ($moduleHandler->moduleExists('update')) {
$links['update.theme_install_'] = array(
$links['update.theme_install_'] = [
'title' => t('Install new theme'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'update.theme_install',
'menu_name' => 'admin',
'parent' => 'system.themes_page',
);
$links['update.theme_update_'] = array(
];
$links['update.theme_update_'] = [
'title' => t('Update'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'update.theme_update',
'menu_name' => 'admin',
'parent' => 'system.themes_page',
);
];
// Lists installed themes.
$installed_themes = installedThemes();
$installed_themes = admin_toolbar_tools_installed_themes();
foreach ($installed_themes as $key_theme => $label_theme) {
$links['system.theme_settings_theme' . '.' . $key_theme] = array(
$links['system.theme_settings_theme.' . $key_theme] = [
'title' => t($label_theme),
'provider' => 'admin_toolbar_tools',
'route_name' => 'system.theme_settings_theme',
'menu_name' => 'admin',
'parent' => 'system.theme_settings_',
'route_parameters' => array(
'route_parameters' => [
'theme' => $key_theme,
),
);
],
];
}
}
// If module Language enabled.
if ($moduleHandler->moduleExists('language')) {
$links['admin_toolbar_tools.language.negotiation'] = [
'title' => t('Detection and selection'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'language.negotiation',
'menu_name' => 'admin',
'parent' => 'entity.configurable_language.collection',
];
}
// If module Media enabled.
if ($moduleHandler->moduleExists('media')) {
$links['admin_toolbar_tools.add_media'] = [
'title' => t('Add media'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.media.add_page',
'menu_name' => 'admin',
'parent' => 'system.admin_content',
];
// Add node links for each media type.
foreach ($entityTypeManager->getStorage('media_type')->loadMultiple() as $type) {
$links['media.add.' . $type->id()] = [
'title' => t($type->label()),
'provider' => 'admin_toolbar_tools',
'route_name' => 'entity.media.add_form',
'parent' => 'admin_toolbar_tools.add_media',
'route_parameters' => ['media_type' => $type->id()],
];
}
}
// If module Config enabled.
if ($moduleHandler->moduleExists('config')) {
$links['admin_toolbar_tools.config.import'] = [
'title' => t('Import'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'config.import_full',
'menu_name' => 'admin',
'parent' => 'config.sync',
'weight' => 1,
];
$links['admin_toolbar_tools.config.export'] = [
'title' => t('Export'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'config.export_full',
'menu_name' => 'admin',
'parent' => 'config.sync',
'weight' => 2,
];
}
}
/**
* Return installed themes.
*
* @return array
* An array of friendly theme names, keyed by the machine name.
*/
function installedThemes() {
$all_themes = \Drupal::service('theme_handler')->listInfo();
$themes_installed = array();
function admin_toolbar_tools_installed_themes() {
$themeHandler = \Drupal::service('theme_handler');
$all_themes = $themeHandler->listInfo();
$themes_installed = [];
foreach ($all_themes as $key_theme => $theme) {
if (\Drupal::service('theme_handler')->hasUi($key_theme)) {
$themes_installed[$key_theme] = $theme->getName();
if ($themeHandler->hasUi($key_theme)) {
$themes_installed[$key_theme] = $themeHandler->getName($key_theme);
}
}
return $themes_installed;
}
/**
* Get all links related to entity
* @param $entity_type_id
* @return array
*/
function getLinks($entity_type_id) {
$entity = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
// Get all links related to entity.
$links = $entity->getLinkTemplates();
return $links;
}

View file

@ -6,38 +6,43 @@ admin_toolbar_tools.flush:
requirements:
_permission: 'administer site configuration'
_csrf_token: 'TRUE'
admin_toolbar_tools.cssjs:
path: '/admin/flush/cssjs'
defaults:
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::flush_js_css'
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::flushJsCss'
_title: 'Flush Css and Javascript'
requirements:
_permission: 'administer site configuration'
_csrf_token: 'TRUE'
admin_toolbar_tools.plugin:
path: '/admin/flush/plugin'
defaults:
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::flush_plugins'
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::flushPlugins'
_title: 'Plugin'
requirements:
_permission: 'administer site configuration'
_csrf_token: 'TRUE'
admin_toolbar_tools.flush_static:
path: '/admin/flush/static-caches'
defaults:
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::flush_static'
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::flushStatic'
_title: 'Static caches'
requirements:
_permission: 'administer site configuration'
_csrf_token: 'TRUE'
admin_toolbar_tools.flush_menu:
path: '/admin/flush/menu'
defaults:
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::flush_menu'
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::flushMenu'
_title: 'Menu'
requirements:
_permission: 'administer site configuration'
_csrf_token: 'TRUE'
admin_toolbar_tools.flush_rendercache:
path: '/admin/flush/rendercache'
defaults:
@ -46,38 +51,25 @@ admin_toolbar_tools.flush_rendercache:
requirements:
_permission: 'administer site configuration'
_csrf_token: 'TRUE'
admin_toolbar_tools.drupalorg:
path: '/admin/drupal8'
admin_toolbar_tools.flush_views:
path: '/admin/flush/views'
defaults:
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::drupal_org'
_title: 'Drupal'
requirements:
_permission: 'access administration pages'
_csrf_token: 'TRUE'
admin_toolbar_tools.listchanges:
path: '/admin/drupal/list-changes'
defaults:
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::list_changes'
_title: 'List changes'
requirements:
_permission: 'access administration pages'
_csrf_token: 'TRUE'
admin_toolbar_tools.doc:
path: '/admin/drupal/documentation'
defaults:
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::documentation'
_title: 'Documentation D8'
requirements:
_permission: 'access administration pages'
_csrf_token: 'TRUE'
admin_development:
path: '/admin/development'
defaults:
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::development'
_title: 'Development'
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::flushViews'
_title: 'Views'
requirements:
_permission: 'administer site configuration'
_csrf_token: 'TRUE'
admin_toolbar_tools.flush_twig:
path: '/admin/flush/twig'
defaults:
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::flushTwig'
_title: 'Twig'
requirements:
_permission: 'administer site configuration'
_csrf_token: 'TRUE'
admin_toolbar.run.cron:
path: '/run-cron'
defaults:

View file

@ -0,0 +1,39 @@
{
"name": "drupal/admin_toolbar_tools",
"description": "Adds menu links to the Admin Toolbar.",
"type": "drupal-module",
"keywords": ["Drupal", "Toolbar"],
"homepage": "http://drupal.org/project/admin_toolbar",
"license": "GPL-2.0+",
"authors": [
{
"name": "Wilfrid Roze (eme)",
"homepage": "https://www.drupal.org/u/eme",
"role": "Maintainer"
},
{
"name": "Romain Jarraud (romainj)",
"homepage": "https://www.drupal.org/u/romainj",
"role": "Maintainer"
},
{
"name": "Adrian Cid Almaguer (adriancid)",
"email": "adriancid@gmail.com",
"homepage": "https://www.drupal.org/u/adriancid",
"role": "Maintainer"
},
{
"name": "Mohamed Anis Taktak (matio89)",
"homepage": "https://www.drupal.org/u/matio89",
"role": "Maintainer"
}
],
"support": {
"issues": "https://www.drupal.org/project/issues/admin_toolbar",
"source": "http://cgit.drupalcode.org/admin_toolbar"
},
"require": {
"drupal/admin_toolbar": "^1",
"drupal/core": "~8.5"
}
}

View file

@ -2,52 +2,130 @@
namespace Drupal\admin_toolbar_tools\Controller;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\CronInterface;
use Drupal\Core\Menu\ContextualLinkManagerInterface;
use Drupal\Core\Menu\LocalActionManagerInterface;
use Drupal\Core\Menu\LocalTaskManagerInterface;
use Drupal\Core\Menu\MenuLinkManagerInterface;
use Drupal\Core\Plugin\CachedDiscoveryClearerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Drupal\Core\Menu\ContextualLinkManager;
use Drupal\Core\Menu\LocalActionManager;
use Drupal\Core\Menu\LocalTaskManager;
use Drupal\Core\Menu\MenuLinkManager;
use Symfony\Component\HttpFoundation\RequestStack;
use Drupal\Core\PhpStorage\PhpStorageFactory;
/**
* Class ToolbarController
* Class ToolbarController.
*
* @package Drupal\admin_toolbar_tools\Controller
*/
class ToolbarController extends ControllerBase {
/**
* The cron service.
* A cron instance.
*
* @var $cron \Drupal\Core\CronInterface
* @var \Drupal\Core\CronInterface
*/
protected $cron;
/**
* A menu link manager instance.
*
* @var \Drupal\Core\Menu\MenuLinkManagerInterface
*/
protected $menuLinkManager;
/**
* A context link manager instance.
*
* @var \Drupal\Core\Menu\ContextualLinkManagerInterface
*/
protected $contextualLinkManager;
/**
* A local task manager instance.
*
* @var \Drupal\Core\Menu\LocalTaskManagerInterface
*/
protected $localTaskLinkManager;
/**
* A local action manager instance.
*
* @var \Drupal\Core\Menu\LocalActionManagerInterface
*/
protected $localActionLinkManager;
/**
* A cache backend interface instance.
*
* @var \Drupal\Core\Cache\CacheBackendInterface
*/
protected $cacheRender;
/**
* Constructs a CronController object.
* A date time instance.
*
* @var \Drupal\Component\Datetime\TimeInterface
*/
protected $time;
/**
* A request stack symfony instance.
*
* @var \Symfony\Component\HttpFoundation\RequestStack
*/
protected $requestStack;
/**
* A plugin cache clear instance.
*
* @var \Drupal\Core\Plugin\CachedDiscoveryClearerInterface
*/
protected $pluginCacheClearer;
/**
* Constructs a ToolbarController object.
*
* @param \Drupal\Core\CronInterface $cron
* The cron service.
* A cron instance.
* @param \Drupal\Core\Menu\MenuLinkManagerInterface $menuLinkManager
* A menu link manager instance.
* @param \Drupal\Core\Menu\ContextualLinkManagerInterface $contextualLinkManager
* A context link manager instance.
* @param \Drupal\Core\Menu\LocalTaskManagerInterface $localTaskLinkManager
* A local task manager instance.
* @param \Drupal\Core\Menu\LocalActionManagerInterface $localActionLinkManager
* A local action manager instance.
* @param \Drupal\Core\Cache\CacheBackendInterface $cacheRender
* A cache backend interface instance.
* @param \Drupal\Component\Datetime\TimeInterface $time
* A date time instance.
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
* A request stack symfony instance.
* @param \Drupal\Core\Plugin\CachedDiscoveryClearerInterface $plugin_cache_clearer
* A plugin cache clear instance.
*/
public function __construct(CronInterface $cron,
MenuLinkManager $menuLinkManager,
ContextualLinkManager $contextualLinkManager,
LocalTaskManager $localTaskLinkManager,
LocalActionManager $localActionLinkManager,
CacheBackendInterface $cacheRender) {
MenuLinkManagerInterface $menuLinkManager,
ContextualLinkManagerInterface $contextualLinkManager,
LocalTaskManagerInterface $localTaskLinkManager,
LocalActionManagerInterface $localActionLinkManager,
CacheBackendInterface $cacheRender,
TimeInterface $time,
RequestStack $request_stack,
CachedDiscoveryClearerInterface $plugin_cache_clearer) {
$this->cron = $cron;
$this->menuLinkManager = $menuLinkManager;
$this->contextualLinkManager = $contextualLinkManager;
$this->localTaskLinkManager = $localTaskLinkManager;
$this->localActionLinkManager = $localActionLinkManager;
$this->cacheRender = $cacheRender;
$this->time = $time;
$this->requestStack = $request_stack;
$this->pluginCacheClearer = $plugin_cache_clearer;
}
/**
@ -60,97 +138,112 @@ class ToolbarController extends ControllerBase {
$container->get('plugin.manager.menu.contextual_link'),
$container->get('plugin.manager.menu.local_task'),
$container->get('plugin.manager.menu.local_action'),
$container->get('cache.render')
$container->get('cache.render'),
$container->get('datetime.time'),
$container->get('request_stack'),
$container->get('plugin.cache_clearer')
);
}
// Reload the previous page.
public function reload_page() {
$request = \Drupal::request();
if($request->server->get('HTTP_REFERER')) {
/**
* Reload the previous page.
*/
public function reloadPage() {
$request = $this->requestStack->getCurrentRequest();
if ($request->server->get('HTTP_REFERER')) {
return $request->server->get('HTTP_REFERER');
}
else{
else {
return '/';
}
}
// Flushes all caches.
/**
* Flushes all caches.
*/
public function flushAll() {
$this->messenger()->addMessage($this->t('All caches cleared.'));
drupal_flush_all_caches();
drupal_set_message($this->t('All caches cleared.'));
return new RedirectResponse($this->reload_page());
return new RedirectResponse($this->reloadPage());
}
// Flushes css and javascript caches.
public function flush_js_css() {
\Drupal::state()
->set('system.css_js_query_string', base_convert(REQUEST_TIME, 10, 36));
drupal_set_message($this->t('CSS and JavaScript cache cleared.'));
return new RedirectResponse($this->reload_page());
/**
* Flushes css and javascript caches.
*/
public function flushJsCss() {
$this->state()
->set('system.css_js_query_string', base_convert($this->time->getCurrentTime(), 10, 36));
$this->messenger()->addMessage($this->t('CSS and JavaScript cache cleared.'));
return new RedirectResponse($this->reloadPage());
}
// Flushes plugins caches.
public function flush_plugins() {
\Drupal::service('plugin.cache_clearer')->clearCachedDefinitions();
drupal_set_message($this->t('Plugins cache cleared.'));
return new RedirectResponse($this->reload_page());
/**
* Flushes plugins caches.
*/
public function flushPlugins() {
$this->pluginCacheClearer->clearCachedDefinitions();
$this->messenger()->addMessage($this->t('Plugins cache cleared.'));
return new RedirectResponse($this->reloadPage());
}
// Resets all static caches.
public function flush_static() {
/**
* Resets all static caches.
*/
public function flushStatic() {
drupal_static_reset();
drupal_set_message($this->t('Static cache cleared.'));
return new RedirectResponse($this->reload_page());
$this->messenger()->addMessage($this->t('Static cache cleared.'));
return new RedirectResponse($this->reloadPage());
}
// Clears all cached menu data.
public function flush_menu() {
/**
* Clears all cached menu data.
*/
public function flushMenu() {
menu_cache_clear_all();
$this->menuLinkManager->rebuild();
$this->contextualLinkManager->clearCachedDefinitions();
$this->localTaskLinkManager->clearCachedDefinitions();
$this->localActionLinkManager->clearCachedDefinitions();
drupal_set_message($this->t('Routing and links cache cleared.'));
return new RedirectResponse($this->reload_page());
$this->messenger()->addMessage($this->t('Routing and links cache cleared.'));
return new RedirectResponse($this->reloadPage());
}
// Links to drupal.org home page.
public function drupal_org() {
$response = new RedirectResponse("https://www.drupal.org");
$response->send();
return $response;
/**
* Clears all cached views data.
*/
public function flushViews() {
views_invalidate_cache();
$this->messenger()->addMessage($this->t('Views cache cleared.'));
return new RedirectResponse($this->reloadPage());
}
// Displays the administration link Development.
public function development() {
return new RedirectResponse('/admin/structure/menu/');
}
// Access to Drupal 8 changes (list changes of the different versions of drupal core).
public function list_changes() {
$response = new RedirectResponse("https://www.drupal.org/list-changes");
$response->send();
return $response;
}
// Adds a link to the Drupal 8 documentation.
public function documentation() {
$response = new RedirectResponse("https://api.drupal.org/api/drupal/8");
$response->send();
return $response;
/**
* Clears the twig cache.
*/
public function flushTwig() {
// @todo Update once Drupal 8.6 will be released.
// @see https://www.drupal.org/node/2908461
PhpStorageFactory::get('twig')->deleteAll();
$this->messenger()->addMessage($this->t('Twig cache cleared.'));
return new RedirectResponse($this->reloadPage());
}
/**
* Run the cron.
*/
public function runCron() {
$this->cron->run();
drupal_set_message($this->t('Cron ran successfully.'));
return new RedirectResponse($this->reload_page());
$this->messenger()->addMessage($this->t('Cron ran successfully.'));
return new RedirectResponse($this->reloadPage());
}
/**
* Clear the rendered cache.
*/
public function cacheRender() {
$this->cacheRender->invalidateAll();
drupal_set_message($this->t('Render cache cleared.'));
return new RedirectResponse($this->reload_page());
$this->messenger()->addMessage($this->t('Render cache cleared.'));
return new RedirectResponse($this->reloadPage());
}
}

View file

@ -1,23 +1,26 @@
<?php
namespace Drupal\admin_toolbar_tools\Tests;
use Drupal\simpletest\WebTestBase;
namespace Drupal\Tests\admin_toolbar_tools\Functional;
use Drupal\Tests\BrowserTestBase;
/**
* Tests for the existence of Admin Toolbar tools new links.
*
* @group admin_toolbar
*/
class AdminToolbarToolsAlterTest extends WebTestBase {
class AdminToolbarToolsAlterTest extends BrowserTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['toolbar', 'admin_toolbar', 'admin_toolbar_tools'];
protected static $modules = [
'toolbar',
'admin_toolbar',
'admin_toolbar_tools',
];
/**
* A test user with permission to access the administrative toolbar.
@ -31,20 +34,21 @@ class AdminToolbarToolsAlterTest extends WebTestBase {
*/
protected function setUp() {
parent::setUp();
// Create and log in an administrative user.
$this->adminUser = $this->drupalCreateUser([
'access toolbar',
'access administration pages',
'administer site configuration',
]);
$this->drupalLogin($this->adminUser);
}
/**
* Tests for a the hover of sub menus.
* Tests for the hover of sub menus.
*/
function testAdminToolbarTools() {
public function testAdminToolbarTools() {
// Assert that special menu items are present in the HTML.
$this->assertRaw('class="toolbar-icon toolbar-icon-admin-toolbar-tools-flush"');
}
}