Skip to content

Commit

Permalink
Home Link: Render Home text if there is no attribute label present (#…
Browse files Browse the repository at this point in the history
…58387)

Co-authored-by: Bernie Reiter <96308+ockham@users.noreply.github.com>
  • Loading branch information
tjcafferkey and ockham authored Jan 30, 2024
1 parent df8142a commit f145f08
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/block-library/src/home-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ function block_core_home_link_build_li_wrapper_attributes( $context ) {
*/
function render_block_core_home_link( $attributes, $content, $block ) {
if ( empty( $attributes['label'] ) ) {
return '';
// Using a fallback for the label attribute allows rendering the block even if no attributes have been set,
// e.g. when using the block as a hooked block.
// Note that the fallback value needs to be kept in sync with the one set in `edit.js` (upon first loading the block in the editor).
$attributes['label'] = __( 'Home' );
}
$aria_current = '';

Expand Down

1 comment on commit f145f08

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in f145f08.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7713390419
📝 Reported issues:

Please sign in to comment.