Navigation Extra Tools
Adds a Tools submenu to the Drupal core Navigation toolbar with quick access to cache flushing, cron execution, and database update functions.
navigation_extra_tools
Install
composer require 'drupal/navigation_extra_tools:^1.3'
Overview
Navigation Extra Tools provides a "Tools" submenu on the new Navigation toolbar in Drupal core, offering convenient shortcuts for common site administration tasks. This module replicates the functionality previously provided by the Admin Toolbar Extra Tools submodule, but designed specifically for the Navigation module introduced in Drupal 10.3.
The module adds quick-access menu items for flushing various caches (all caches, CSS/JavaScript, plugins, static, menu/routing, render, Twig, Views, and theme registry), running cron manually, and accessing database updates. These actions are accessible directly from the navigation sidebar without needing to navigate to separate administration pages.
When the Devel module is installed, Navigation Extra Tools automatically adds a Development submenu under Tools, providing access to Devel's debugging and development utilities. The module also integrates with Project Browser to offer a quick storage clearing option.
Features
- Adds a "Tools" menu with a wrench icon to the Navigation toolbar sidebar
- Provides quick "Flush all caches" functionality identical to the Performance page cache clearing
- Offers individual cache flushing options for CSS/JavaScript, plugins, static cache, routing/links, Twig templates, render cache, Views cache, and theme registry
- Adds "Run cron" menu item for manual cron execution from the navigation bar
- Includes "Run updates" link to access database update functionality
- Automatically integrates with the Devel module when installed, adding a Development submenu with configurable Devel tools
- Supports Webprofiler settings integration when both Devel and Webprofiler modules are enabled
- Integrates with Devel PHP module to provide Execute PHP Code option when available
- Adds Project Browser submenu with clear storage option when Project Browser module is installed
- Uses permission-based visibility to show only relevant menu items to each user
- Automatically grants new permissions to roles that have 'administer site configuration' permission during updates
Use Cases
Quick cache clearing during development
During theme or module development, developers frequently need to clear caches to see their changes. Instead of navigating to /admin/config/development/performance, developers can simply click Tools > Flush all caches directly from the navigation sidebar on any page.
Targeted cache clearing for specific issues
When troubleshooting issues with specific site components, administrators can use the individual cache flushing options. For example, if Twig templates aren't updating, use Tools > Flush individual cache > Flush Twig cache. If menu links aren't appearing correctly, use Flush routing and links cache.
Manual cron execution for testing
When developing or testing cron-based functionality (such as scheduled content publishing or search indexing), administrators can trigger cron manually via Tools > Run cron without waiting for the scheduled cron interval.
Development workflow with Devel module
Developers using the Devel module can access debugging tools directly from the navigation bar. The Development submenu provides quick access to commonly used Devel functions like viewing configuration, managing state variables, and inspecting entity information.
Project Browser cache refresh
When using Project Browser to discover and install modules, if the module listings appear outdated, administrators can use Tools > Project Browser > Clear storage to force a refresh of the cached project data.
Theme development with immediate feedback
Theme developers can use the 'Rebuild theme registry' option to immediately register new template files or theme function changes without clearing all caches, providing faster iteration during theme development.
Tips
- The module automatically grants cache flushing and cron permissions to any role that has 'administer site configuration' permission when installed or updated
- All cache flushing and cron actions redirect back to the referring page after completion, making it convenient to stay on the page you're working on
- The wrench icon used for the Tools menu comes from Phosphor Icons, maintaining visual consistency with Drupal's Navigation toolbar design
- When Devel is installed after Navigation Extra Tools, the module automatically enables a standard set of Devel menu items for consistency with Admin Toolbar Extra Tools
- Unlike some cache clearing methods, the individual cache options provide surgical precision for clearing only specific caches, which can be faster and more appropriate during development
Technical Details
Admin Pages 15
/admin/tools
Parent container page for all Tools menu functions. This page displays available tool categories based on the user's permissions. The actual functionality is accessed through the child menu items rather than this page itself.
/admin/flush
Clears all site caches in a single action. This is equivalent to clicking 'Clear all caches' on the Performance page (/admin/config/development/performance). After execution, the user is redirected back to the previous page with a confirmation message.
/admin/tools/individual
Container page for individual cache flushing options. Provides access to granular cache clearing functions for specific subsystems.
/admin/flush/css-js
Clears the CSS and JavaScript aggregation cache by resetting the asset query string. This forces browsers to download fresh versions of aggregated CSS and JavaScript files.
/admin/flush/plugin
Clears all cached plugin definitions. Useful when developing custom plugins or after installing modules that provide new plugins.
/admin/flush/static-caches
Resets all static caches stored in memory during the current request. Primarily useful for developers during debugging.
/admin/flush/menu
Clears all cached menu data including menu links, contextual links, local tasks, and local actions. Also rebuilds the menu link plugin definitions.
/admin/flush/render-cache
Clears the render cache which stores pre-rendered versions of pages and page elements.
/admin/flush/views
Invalidates all Views-specific cached data. Useful when Views are not displaying updated content.
/admin/flush/twig
Clears the compiled Twig template cache. Required when making changes to Twig templates during theme development.
/admin/flush/theme_rebuild
Rebuilds the theme registry which contains information about all available theme hooks. Useful when adding new template files or theme functions.
/run-cron
Manually triggers a cron run. Executes all registered cron tasks including content indexing, log cleanup, and other scheduled maintenance operations.
/admin/tools/devel
Container page for Devel module integration. Only visible when the Devel module is installed. Provides access to Devel debugging and development tools configured in Devel Toolbar Settings.
/admin/project_browser
Container page for Project Browser module integration. Only visible when the Project Browser module is installed.
/admin/project_browser/clear
Clears the Project Browser's cached project data storage. Useful when the Project Browser is showing stale module/theme information.
Permissions 2
Hooks 3
hook_library_info_alter
Alters library definitions to add toolbar dependency when toolbar module is enabled, ensuring proper library loading.
hook_page_attachments
Attaches the navigation_extra_tools/icon library to pages for users with 'access navigation' permission, enabling the Tools menu wrench icon display.
hook_modules_installed
Responds to module installation events. When the Devel module is installed, automatically enables a predefined set of Devel menu items in the toolbar configuration.
Troubleshooting 5
Ensure the user has at least one of the following permissions: 'Access navigation extra tools: cache flushing', 'Access navigation extra tools: cron', or access to Devel functions (if Devel is installed). The Tools menu only appears if the user has access to at least one child menu item.
The Development submenu only appears when the Devel module is installed and enabled. Additionally, the user must have either 'administer site configuration' or 'access devel information' permission.
Devel menu items are configured through the Devel module's toolbar settings at /admin/config/development/devel/toolbar. Check this page to ensure the desired items are enabled.
Run database updates (drush updb or /update.php) to execute the post_update hook that grants the new permissions to roles with 'administer site configuration'. Alternatively, manually grant the permissions at /admin/people/permissions.
Ensure the CSRF token protection is working correctly. Cache clearing routes require valid CSRF tokens for security. If issues persist, check that session handling is configured correctly.
Security Notes 4
- Cache flushing and cron permissions are marked as 'restrict access' meaning they should only be granted to trusted administrative roles
- All cache flushing and cron routes are protected with CSRF tokens to prevent cross-site request forgery attacks
- The Tools menu visibility is dynamically calculated based on the current user's permissions to child menu items, ensuring users only see functions they can access
- Database update access (/update.php) requires the 'administer software updates' permission, which is separate from the module's permissions