Skip to content

Commit

Permalink
Use correct classnames for navigation link block save output (#18926)
Browse files Browse the repository at this point in the history
* Use correct classnames for navigation link block save output

* Classname audit. Remove unused `__inner` classname. Rename `__link` classname to `__content` to match the block edit classnames
  • Loading branch information
talldan authored Dec 6, 2019
1 parent 5e68cdc commit 2d2c368
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/block-library/src/navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function NavigationLinkEdit( {
'has-link': !! url,
} ) }
>
<div className="wp-block-navigation-link__inner">
<div>
<RichText
className="wp-block-navigation-link__content"
value={ label }
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ function render_block_navigation( $attributes, $content, $block ) {
function build_navigation_html( $block, $colors ) {
$html = '';
$css_classes = implode( ' ', $colors['css_classes'] );
$class_attribute = sprintf( ' class="%s"', esc_attr( ! empty( $css_classes ) ? 'wp-block-navigation-item__link ' . $css_classes : 'wp-block-navigation-item__link' ) );
$class_attribute = sprintf( ' class="wp-block-navigation-link__content %s"', esc_attr( trim( $css_classes ) ) );
$style_attribute = $colors['inline_styles'] ? sprintf( ' style="%s"', esc_attr( $colors['inline_styles'] ) ) : '';

foreach ( (array) $block['innerBlocks'] as $key => $block ) {

$html .= '<li class="wp-block-navigation-item">' .
$html .= '<li class="wp-block-navigation-link">' .
'<a' . $class_attribute . $style_attribute;

// Start appending HTML attributes to anchor tag.
Expand Down

0 comments on commit 2d2c368

Please sign in to comment.