Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By pwolanin on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
follow-up to changes already described in https://drupal.org/node/2044515. That notice is being updated to reflect this change.
The keys in the yaml file are shortened and redundancy removed.
before:
custom_block.list:
title: 'Custom block library'
route_name: custom_block.list
tab_root_id: block.admin_display
custom_block.list_sub:
title: Blocks
route_name: custom_block.list
tab_root_id: block.admin_display
tab_parent_id: custom_block.list
custom_block.type_list:
title: Types
route_name: custom_block.type_list
tab_root_id: block.admin_display
tab_parent_id: custom_block.list
custom_block.edit:
title: Edit
route_name: custom_block.edit
tab_root_id: custom_block.edit
custom_block.delete:
title: Delete
route_name: custom_block.delete
tab_root_id: custom_block.edit
After:
custom_block.list:
title: 'Custom block library'
route_name: custom_block.list
base_route: block.admin_display
custom_block.list_sub:
title: Blocks
route_name: custom_block.list
parent_id: custom_block.list
custom_block.type_list:
title: Types
route_name: custom_block.type_list
parent_id: custom_block.list
custom_block.edit:
title: Edit
route_name: custom_block.edit
base_route: custom_block.edit
custom_block.delete:
title: Delete
route_name: custom_block.delete
base_route: custom_block.edit
Another after example for users:
# The user page has a Log in tab by default
user.page:
route_name: user.page
base_route: user.page
title: 'Log in'
weight: -10
# A second account creation tab
user.register:
route_name: user.register
base_route: user.page
title: 'Create new account'
# User password request tab.
user.pass:
route_name: user.pass
base_route: user.page
title: 'Request new password'
# Subtab for username and password based login. This will not appear unless
# more subtabs are added. Other authentication methods may add pages below
# user/login/.
user.login:
route_name: user.login
parent_id: user.page
title: 'Username and password'
New keys are:
- route_name: The machine name of the local task route - this also determines where it's displayed.
- title: The title of the local action. By default, it will be passed through t() and localized. Strings with spaces should use single quotes.
- base_route (optional): The route where the "root" tab (generally the top, leftmost one) is displayed and which serves to group a set of tabs. Should be omitted when parent_id is set. Required when no parent_id is set.
- parent_id (optional): The plugin ID of the tab that is the parent - only relevant for 2nd level tabs. If this is set, base_route should be omitted and will be supplied from the parent
- weight: (optional) The integer weight (lower weight tabs are further left, default is 0).
Note in particular that by defining a base_route, it's simpler to discover how to associate a tab, rather than having to find a plugin ID.
In addition, when a tab has a parent, it's no longer necessary to define the grouping, since that inherited (naturally) from the parent.
Impacts:
Module developers