Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Nov 20, 2024
1 parent ccb8168 commit e090dba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 30 deletions.
52 changes: 25 additions & 27 deletions packages/block-library/src/home-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,30 @@ export default function HomeEdit( { attributes, setAttributes, context } ) {
} );

return (
<>
<div { ...blockProps }>
<a
className="wp-block-home-link__content wp-block-navigation-item__content"
href={ homeUrl }
onClick={ preventDefault }
>
<RichText
identifier="label"
className="wp-block-home-link__label"
value={ attributes.label ?? __( 'Home' ) }
onChange={ ( labelValue ) => {
setAttributes( { label: labelValue } );
} }
aria-label={ __( 'Home link text' ) }
placeholder={ __( 'Add home link' ) }
withoutInteractiveFormatting
allowedFormats={ [
'core/bold',
'core/italic',
'core/image',
'core/strikethrough',
] }
/>
</a>
</div>
</>
<div { ...blockProps }>
<a
className="wp-block-home-link__content wp-block-navigation-item__content"
href={ homeUrl }
onClick={ preventDefault }
>
<RichText
identifier="label"
className="wp-block-home-link__label"
value={ attributes.label ?? __( 'Home' ) }
onChange={ ( labelValue ) => {
setAttributes( { label: labelValue } );
} }
aria-label={ __( 'Home link text' ) }
placeholder={ __( 'Add home link' ) }
withoutInteractiveFormatting
allowedFormats={ [
'core/bold',
'core/italic',
'core/image',
'core/strikethrough',
] }
/>
</a>
</div>
);
}
3 changes: 0 additions & 3 deletions packages/block-library/src/home-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ function block_core_home_link_build_li_wrapper_attributes( $context ) {
*/
function render_block_core_home_link( $attributes, $content, $block ) {
if ( empty( $attributes['label'] ) ) {
// 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

0 comments on commit e090dba

Please sign in to comment.