Follow-up to #2614950: Add option for visually-hidden block titles
Problem/Motivation
During #2614950: Add option for visually-hidden block titles we are introducing new label_display options to manage the blocks' title display. For backward compatibility, we have to keep the existing value of the title being hidden to "0" what's not consistent with the other options ("visible" and "visually_hidden").
In Drupal 9, we should change the value of the \Drupal\Core\Block\BlockPluginInterface::BLOCK_LABEL_HIDDEN
constant to "hidden" for consistency. And adjust all related stuff like preprocesses or templates that relies on that value.
Proposed resolution
- change
\Drupal\Core\Block\BlockPluginInterface::BLOCK_LABEL_HIDDEN
value to "hidden" - adapt
core/themes/stable/templates/block/block--system-menu-block.html.twig
- adapt
core/themes/classy/templates/block/block--system-menu-block.html.twig
- adapt
core/modules/system/templates/block--system-menu-block.html.twig
- adapt
template_preprocess_block
- update hook for existing sites, to change stored
0
values tohidden
- updates to default installation config (profiles)
Remaining tasks
Wait till D9
User interface changes
None
API changes
None
Data model changes
block.block.*:settings.label_display
value is now "hidden" when the title is disabled
Comment | File | Size | Author |
---|---|---|---|
#20 | interdiff_17-20.txt | 503 bytes | Suresh Prabhu Parkala |
#20 | 2863313-20.patch | 1.38 KB | Suresh Prabhu Parkala |
| |||
#17 | 2863313-17.patch | 1.38 KB | djsagar |
| |||
#17 | interdiff_8-17.txt | 553 bytes | djsagar |
#8 | interdiff_6-8.txt | 1.25 KB | shetpooja04 |
Comments
Comment #2
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedThe proposed change to Stable and Classy template would require sign-off from their maintainers, but I see this has been targeted at D9. Tagging for attention anyway.
Comment #3
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedThe data model change will also require:
0
values tohidden
Adding those to issue summary.
Comment #5
xjmThis would be a minor-only change. Since 8.9.x and 9.0.x are now in beta, I'm moving this to 9.1.x. Thanks!
Comment #6
shetpooja04 CreditAttribution: shetpooja04 at QED42 commentedHi
I have worked on
For points
change \Drupal\Core\Block\BlockPluginInterface::BLOCK_LABEL_HIDDEN value to "hidden" :
I have taken the reference from https://www.drupal.org/project/drupal/issues/2614950 for changes in file core/lib/Drupal/Core/Block/BlockPluginInterface.php
update hook for existing sites, to change stored 0 values to hidden :
I have add
hook_update_N
, please review in file core/modules/block/block.installI have not included any changes in tests here, Please review the functionality
Comment #7
shetpooja04 CreditAttribution: shetpooja04 at QED42 commentedComment #8
shetpooja04 CreditAttribution: shetpooja04 at QED42 commentedAdding the patch again with few corrections
Comment #10
ashishdalviComment #16
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis will need to be updated for D10. Hook was targeting D8 it seems.
Comment #17
djsagar CreditAttribution: djsagar at OpenSense Labs commentedFixed it for D10.
Please review.
Comment #18
djsagar CreditAttribution: djsagar at OpenSense Labs commentedComment #19
smustgrave CreditAttribution: smustgrave at Mobomo commentedThank you for the patch but didn’t need a reroll but to be updated
Comment #20
Suresh Prabhu Parkala CreditAttribution: Suresh Prabhu Parkala at Specbee commentedTried to update the patch for drupal 10. Please review.
Comment #21
smustgrave CreditAttribution: smustgrave at Mobomo commentedSo from learning more about post-updates I think this would be better served as a post-update hook instead.