Commit 942998aa authored by matio89's avatar matio89

add new fonctionalities

parent 2d886344
......@@ -80,7 +80,7 @@ function toolbar_prerender_admin_toolbar_administration_tray(array $element) {
$menu_tree = \Drupal::menuTree();
// Render the top-level administration menu links.
$parameters = new \Drupal\Core\Menu\MenuTreeParameters();
$parameters->setRoot('system.admin')->excludeRoot()->setMaxDepth(3);
$parameters->setRoot('system.admin')->excludeRoot()->setMaxDepth(4);
$tree = $menu_tree->load(NULL, $parameters);
$manipulators = array(
array('callable' => 'menu.default_tree_manipulators:checkAccess'),
......
......@@ -27,6 +27,10 @@ admin_toolbar_tools.flush_static:
title: Static caches
route_name: admin_toolbar_tools.flush_static
parent: admin_toolbar_tools.flush
admin_toolbar_tools.flush_menu:
title: Menu
route_name: admin_toolbar_tools.flush_menu
parent: admin_toolbar_tools.flush
system.run_cron:
title: Run cron
weight: -8
......@@ -34,12 +38,12 @@ system.run_cron:
parent: admin_toolbar_tools.help
system.db_update:
title: Run Updates
weight: -7
weight: -6
route_name: system.db_update
parent: admin_toolbar_tools.help
admin_toolbar_tools.drupalorg:
title: Drupal.org
weight: -6
weight: -5
route_name: admin_toolbar_tools.drupalorg
parent: admin_toolbar_tools.help
admin_toolbar_tools.listchanges:
......@@ -52,3 +56,96 @@ admin_toolbar_tools.doc:
weight: -5
route_name: admin_toolbar_tools.doc
parent: admin_toolbar_tools.drupalorg
admin_development:
title: Development
weight: -8
route_name: admin_development
parent: admin_toolbar_tools.help
update.module_update:
title: Update
route_name: update.module_update
parent: system.modules_list
weight: -1
system.modules_uninstall:
title: Uninstall
route_name: system.modules_uninstall
parent: system.modules_list
weight: -2
update.module_install:
title: Install new module
route_name: update.module_install
parent: system.modules_list
weight: -3
#add menu to people
user.admin_create:
title: Add user
route_name: user.admin_create
parent: entity.user.collection
weight: -5
user.admin_permissions:
title: Permissions
route_name: user.admin_permissions
parent: entity.user.collection
weight: -4
user.admin_create:
title: Add user
route_name: user.admin_create
parent: entity.user.collection
weight: -3
entity.user_role.collection:
title: Roles
route_name: entity.user_role.collection
parent: entity.user.collection
weight: -2
node.add_page:
parent: system.admin_content
node.type_add:
title: Add content type
route_name: node.type_add
parent: entity.node_type.collection
weight: -5
entity.taxonomy_vocabulary.add_form:
title: Add vocabulary
route_name: entity.taxonomy_vocabulary.add_form
parent: entity.taxonomy_vocabulary.collection
weight: -5
entity.comment_type.add_form:
title: Add comment type
route_name: entity.comment_type.add_form
parent: entity.comment_type.collection
weight: -5
entity.menu.add_form:
title: Add menu
route_name: entity.menu.add_form
parent: entity.menu.collection
weight: -50
block_content.add_page:
title: Add custom block
route_name: block_content.add_page
parent: block.admin_display
weight: -5
entity.block_content.collection:
title: Custom block library
route_name: entity.block_content.collection
parent: block.admin_display
weight: -4
entity.block_content_type.collection:
title: Types
route_name: entity.block_content_type.collection
parent: block.admin_display
weight: -3
block_content.type_add:
title: Add
route_name: block_content.type_add
parent: entity.block_content_type.collection
weight: -5
contact.form_add:
title: Add contact form
route_name: contact.form_add
parent: entity.contact_form.collection
weight: -5
#links comments
comment.admin_approval:
title: Unapproved comments
route_name: comment.admin_approval
parent: comment.admin
\ No newline at end of file
......@@ -30,7 +30,14 @@ admin_toolbar_tools.flush_static:
path: '/admin/flush/static-caches'
defaults:
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::flush_static'
_title: 'static caches'
_title: 'Static caches'
requirements:
_permission: 'access administration pages'
admin_toolbar_tools.flush_menu:
path: '/admin/flush/menu'
defaults:
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::flush_menu'
_title: 'Menu'
requirements:
_permission: 'access administration pages'
admin_toolbar_tools.drupalorg:
......@@ -52,5 +59,12 @@ admin_toolbar_tools.doc:
defaults:
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::documentation'
_title: 'Documentation D8'
requirements:
_permission: 'access administration pages'
admin_development:
path: '/admin/development'
defaults:
_controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::development'
_title: 'Development'
requirements:
_permission: 'access administration pages'
\ No newline at end of file
......@@ -11,23 +11,32 @@ namespace Drupal\admin_toolbar_tools\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
* Class ToolbarController
* @package Drupal\admin_toolbar_tools\Controller
*/
class ToolbarController extends ControllerBase {
//This function display the tools in the menu.
//Redirect to home.
public function home() {
return new RedirectResponse('/');
}
//This function flush all caches.
//Reload the previous page.
public function reload_page() {
$request = \Drupal::request();
return $request->server->get('HTTP_REFERER');
}
//Flush all caches.
public function flushAll() {
drupal_flush_all_caches();
drupal_set_message(t('All cache cleared.'));
return new RedirectResponse('/');
return new RedirectResponse($this->reload_page());
}
public function testdb() {
dpm(contact_message_get_names());
}
//This function flush css and javascript caches.
......@@ -35,7 +44,7 @@ class ToolbarController extends ControllerBase {
\Drupal::state()
->set('system.css_js_query_string', base_convert(REQUEST_TIME, 10, 36));
drupal_set_message(t('CSS and JavaScript cache cleared.'));
return new RedirectResponse('/');
return new RedirectResponse($this->reload_page());
}
//This function flush plugins caches.
......@@ -43,14 +52,21 @@ class ToolbarController extends ControllerBase {
// Clear all plugin caches.
\Drupal::service('plugin.cache_clearer')->clearCachedDefinitions();
drupal_set_message(t('Plugin cache cleared.'));
return new RedirectResponse('/');
return new RedirectResponse($this->reload_page());
}
// Reset all static caches.
public function flush_static() {
drupal_static_reset();
drupal_set_message(t('All static caches cleared.'));
return new RedirectResponse('/');
return new RedirectResponse($this->reload_page());
}
// Clears all cached menu data.
public function flush_menu() {
menu_cache_clear_all();
drupal_set_message(t('All cached menu data cleared.'));
return new RedirectResponse($this->reload_page());
}
// this function allow to access in documentation via admin_toolbar module
......@@ -60,6 +76,11 @@ class ToolbarController extends ControllerBase {
return $response;
}
//This function display the administration link Development
public function development() {
return new RedirectResponse('/admin/structure/menu/');
}
// this function allow to access in documentation(list changes of the different versions of drupal core) via admin_toolbar module.
public function list_changes() {
$response = new RedirectResponse("https://www.drupal.org/list-changes");
......@@ -74,4 +95,5 @@ class ToolbarController extends ControllerBase {
return $response;
}
}
\ No newline at end of file
......@@ -40,4 +40,10 @@
top: 0;
left: 160px;
width: 160px;
}
.toolbar .toolbar-tray-vertical li.open > ul.menu {
display: none;
}
.toolbar .toolbar-tray-vertical li.open > ul.menu.clearfix {
display: block;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment