Commit f98362c4 authored by romainj's avatar romainj

Minor code/typo cleaning

parent 3993f41a
toolbar.icon:
version: VERSION
css:
theme:
css/tools.css: {}
\ No newline at end of file
admin_toolbar_tools.flush:
title: Flush all caches
title: 'Flush all caches'
route_name: admin_toolbar_tools.flush
weight: -9
parent: admin_toolbar_tools.help
admin_toolbar_tools.cssjs:
title: CSS and Javascript
title: 'CSS and Javascript'
route_name: admin_toolbar_tools.cssjs
parent: admin_toolbar_tools.flush
admin_toolbar_tools.plugin:
title: Plugins
title: 'Plugins'
route_name: admin_toolbar_tools.plugin
parent: admin_toolbar_tools.flush
admin_toolbar_tools.flush_static:
title: Static caches
title: 'Static caches'
route_name: admin_toolbar_tools.flush_static
parent: admin_toolbar_tools.flush
admin_toolbar_tools.flush_menu:
......@@ -20,17 +20,17 @@ admin_toolbar_tools.flush_menu:
route_name: admin_toolbar_tools.flush_menu
parent: admin_toolbar_tools.flush
admin_toolbar_tools.drupalorg:
title: Drupal.org
title: 'Drupal.org'
weight: -5
route_name: admin_toolbar_tools.drupalorg
parent: admin_toolbar_tools.help
admin_toolbar_tools.listchanges:
title: List changes D8
title: 'Change records for Drupal core'
weight: -6
route_name: admin_toolbar_tools.listchanges
parent: admin_toolbar_tools.drupalorg
admin_toolbar_tools.doc:
title: Documentation D8
title: 'D8 API documentation'
weight: -5
route_name: admin_toolbar_tools.doc
parent: admin_toolbar_tools.drupalorg
......@@ -36,7 +36,7 @@ function admin_toolbar_tools_help($route_name, RouteMatchInterface $route_match)
case 'help.page.admin_toolbar_tools':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Admin Toolbar Extra Tools module allows you to to add more fonctionalities to the default toolbar like flush caches, runnig cron.') . '</p>';
$output .= '<p>' . t('The Admin Toolbar Extra Tools module allows you to to add more functionalities to the default toolbar like flushing caches, running cron.') . '</p>';
return $output;
}
......@@ -47,6 +47,7 @@ function admin_toolbar_tools_help($route_name, RouteMatchInterface $route_match)
*/
function admin_toolbar_tools_menu_links_discovered_alter(&$links) {
$moduleHandler = \Drupal::moduleHandler();
$links['admin_toolbar_tools.help'] = array(
'title' => t('Tools'),
'route_name' => '<front>',
......@@ -73,7 +74,7 @@ function admin_toolbar_tools_menu_links_discovered_alter(&$links) {
'weight' => -6
);
$links['system.modules_uninstall'] = array(
'title' => t('Uninstall'),
'title' => t('Uninstall module'),
'route_name' => 'system.modules_uninstall',
'parent' => 'system.modules_list',
);
......@@ -102,10 +103,10 @@ function admin_toolbar_tools_menu_links_discovered_alter(&$links) {
);
/**
* Add common links to entities if parent module exists.
* The common links for entities are :
* - Editing entity, Deleting entity,manage fields for entity
* The common links for entities are:
* - Editing entity, Deleting entity, manage fields for entity
* manage form display for an entity, entity view display
* and others links relating to entity
* and others links related to entity.
*/
foreach ($content_entities as $module_name => $entities) {
if ($moduleHandler->moduleExists($module_name)) {
......@@ -173,7 +174,7 @@ function admin_toolbar_tools_menu_links_discovered_alter(&$links) {
'route_name' => 'entity.user_role.collection',
'parent' => 'entity.user.collection',
);
$links['user.logoutt'] = array(
$links['user.logout'] = array(
'title' => t('Logout'),
'route_name' => 'user.logout',
'parent' => 'admin_toolbar_tools.help',
......@@ -332,7 +333,7 @@ function admin_toolbar_tools_menu_links_discovered_alter(&$links) {
'parent' => 'block.admin_display',
);
}
// If module contact is enabled.
// If module Contact is enabled.
if ($moduleHandler->moduleExists('contact')) {
$links['contact.form_add'] = array(
'title' => t('Add contact form'),
......
<?php
/**
* @file
* Contains \Drupal\admin_toolbar_tools\Controller\ToolbarController.
......@@ -7,7 +8,6 @@
namespace Drupal\admin_toolbar_tools\Controller;
//Use the necessary classes
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\CronInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -22,10 +22,11 @@ use Drupal\Core\Menu\MenuLinkManager;
* @package Drupal\admin_toolbar_tools\Controller
*/
class ToolbarController extends ControllerBase {
/**
* The cron service.
*
* @var \Drupal\Core\CronInterface
* @var $cron \Drupal\Core\CronInterface
*/
protected $cron;
......@@ -64,20 +65,21 @@ class ToolbarController extends ControllerBase {
$container->get('plugin.manager.menu.local_action')
);
}
//Reload the previous page.
// Reload the previous page.
public function reload_page() {
$request = \Drupal::request();
return $request->server->get('HTTP_REFERER');
}
//Flush all caches.
// Flushes all caches.
public function flushAll() {
drupal_flush_all_caches();
drupal_set_message($this->t('All cache cleared.'));
return new RedirectResponse($this->reload_page());
}
//This function flush css and javascript caches.
// Flushes css and javascript caches.
public function flush_js_css() {
\Drupal::state()
->set('system.css_js_query_string', base_convert(REQUEST_TIME, 10, 36));
......@@ -85,22 +87,21 @@ class ToolbarController extends ControllerBase {
return new RedirectResponse($this->reload_page());
}
//This function flush plugins caches.
// Flushes plugins caches.
public function flush_plugins() {
// Clear all plugin caches.
\Drupal::service('plugin.cache_clearer')->clearCachedDefinitions();
drupal_set_message($this->t('Plugin cache cleared.'));
return new RedirectResponse($this->reload_page());
}
// Reset all static caches.
// Resets all static caches.
public function flush_static() {
drupal_static_reset();
drupal_set_message($this->t('All static caches cleared.'));
return new RedirectResponse($this->reload_page());
}
// Clears all cached menu data.
// Clears all cached menu data.
public function flush_menu() {
menu_cache_clear_all();
$this->menuLinkManager->rebuild();
......@@ -111,26 +112,26 @@ class ToolbarController extends ControllerBase {
return new RedirectResponse($this->reload_page());
}
// this function allow to access in documentation via admin_toolbar module
// Links to drupal.org home page.
public function drupal_org() {
$response = new RedirectResponse("https://www.drupal.org");
$response->send();
return $response;
}
//This function display the administration link Development
// Displays 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.
// 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;
}
//this function allow to add
// Adds a link to the Drupal 8 documentation.
public function documentation() {
$response = new RedirectResponse("https://api.drupal.org/api/drupal/8");
$response->send();
......@@ -143,5 +144,4 @@ class ToolbarController extends ControllerBase {
return new RedirectResponse($this->reload_page());
}
}
\ 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