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 to hidden
  • 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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DuaelFr created an issue. See original summary.

andrewmacpherson’s picture

Issue tags: +stable, +Classy

The 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.

andrewmacpherson’s picture

Issue summary: View changes

The data model change will also require:

  • an update hook for existing sites, to change stored 0 values to hidden
  • updates to default installation config, for profiles

Adding those to issue summary.

Version: 9.x-dev » 9.0.x-dev

The 9.0.x branch will open for development soon, and the placeholder 9.x branch should no longer be used. Only issues that require a new major version should be filed against 9.0.x (for example, removing deprecated code or updating dependency major versions). New developments and disruptive changes that are allowed in a minor version should be filed against 8.9.x, and significant new features will be moved to 9.1.x at committer discretion. For more information see the Allowed changes during the Drupal 8 and 9 release cycles and the Drupal 9.0.0 release plan.

xjm’s picture

Version: 9.0.x-dev » 9.1.x-dev

This 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!

shetpooja04’s picture

Hi

I have worked on

  • change \Drupal\Core\Block\BlockPluginInterface::BLOCK_LABEL_HIDDEN value to "hidden"
  • update hook for existing sites, to change stored 0 values to hidden

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.install

I have not included any changes in tests here, Please review the functionality

shetpooja04’s picture

Status: Active » Needs review
shetpooja04’s picture

Adding the patch again with few corrections

The last submitted patch, 6: 2863313-6.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

ashishdalvi’s picture

Issue tags: +DIACWAug2020

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work

This will need to be updated for D10. Hook was targeting D8 it seems.

djsagar’s picture

Fixed it for D10.
Please review.

djsagar’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Thank you for the patch but didn’t need a reroll but to be updated

Suresh Prabhu Parkala’s picture

Status: Needs work » Needs review
FileSize
1.38 KB
503 bytes

Tried to update the patch for drupal 10. Please review.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

So from learning more about post-updates I think this would be better served as a post-update hook instead.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.