Problem/Motivation
When the Block module is not installed, Drupal falls back to SimplePageVariant.
It displays status messages, the page title, and the main content, but neither local tasks nor local actions:
- the "Index" tab disappears from the "Administration" page,
- the "Permissions" and "Roles" tabs and the "Add user" action disappear from the "People" page,
- the "Add role" action disappears from the "Roles" page,
- the "Add format" action disappears from the "Date and time formats" page,
- ...
Thus, without Block module being installed, these targets can only be accessed by manually entering their URLs.
This limitation was already noted in #507488-411: Convert page elements (local tasks, actions) into blocks.
Impact
If Layout Builder and Block Content drop their dependencies on the Block module, users on sites without it still need to be able to
- open a node's layout for editing from the "Layout" tab (#3003610: Remove block.module dependency from Layout Builder), and
- go from "Content" to "Blocks" and choose "Add content block" (#3206952: Remove block.module dependency from block_content).
The Block Content MR !12156 currently provides a test-only PageVariant to circumvent the limitation, so its functional tests can do their job. #3524985: Reduce dependency on block.module in tests proposes the same approach for other tests. Where tests only need tabs and actions, they could use SimplePageVariant and exercise the same navigation as users.
Steps to reproduce
- Install Drupal using the Minimal profile and sign in as the site administrator.
- Visit
/adminand check that the "Index" tab is present. - Visit
/admin/peopleand check that the "Permissions" and "Roles" tabs and the "Add user" action are present. - Follow the "Roles" tab to
/admin/people/rolesand check that the "Add role" action is present. - Visit
/admin/config/regional/date-timeand check that the "Add format" action is present. - Now uninstall the Block module at
/admin/modules/uninstall. - Return to the four pages visited before. See that all of these tabs and actions are missing.
- Visit
/admin/config/people/accounts. Under "When cancelling a user account", you'll find a small link on "permissions". It still opens/admin/people/permissions. - Visit
/admin/config/development/maintenance. In the description of "Put site into maintenance mode", follow the small "permission" link. It opens the same page. - Open the other five targets directly:
/admin/index,/admin/people/roles,/admin/people/create,/admin/people/roles/add, and/admin/config/regional/date-time/formats/add. All five pages are still accessible.
Proposed resolution
Restore the links to related pages and forms when Drupal falls back to SimplePageVariant.
- Place
local_tasks_blockandlocal_actions_blockbetween the page title and the main content, tabs first. Use both plugins with their default settings. - Check access to each block and use the shared block plugin renderer for its themed output. Honor each plugin's request for a placeholder and preserve cacheability even when access is denied or no links are shown.
Test that a single tab at either level stays hidden, while two of them are shown, as is a single local action. Ensure cached pages show the correct links for each route and user.
Remaining tasks
Postponed on #2931040: Consider adding a BlockPluginInterface::toRenderArray(), which in turn depends on #3644069: Move the block theme hook and its default Twig template from Block to System.
User interface changes
Without the Block module, SimplePageVariant now displays local tasks and local actions, such as the "Uninstall" tab on the "Extend" page and the "Add content type" action on the "Content types" page.
Introduced terminology
None.
API changes
None.
Data model changes
None.
Release notes snippet
Local tasks and local actions are now displayed even when the Block module is not installed.
Comments