Skip to content

Commit

Permalink
navigation: fix adding CSS custom class issue. (#18629)
Browse files Browse the repository at this point in the history
It's a regression done by mistake. The original issue was taken over by @obenland (props!)
  • Loading branch information
retrofox committed Nov 20, 2019
1 parent d3e7c6b commit c79b5d9
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions packages/block-library/src/navigation/index.php
Expand Up @@ -49,21 +49,17 @@ function build_css_colors( $attributes ) {
* @return string Returns the post content with the legacy widget added.
*/
function render_block_navigation( $attributes, $content, $block ) {
$colors = build_css_colors( $attributes );
$class_attribute = sprintf( ' class="%s"', esc_attr( $colors['css_classes'] ? 'wp-block-navigation ' . $colors['css_classes'] : 'wp-block-navigation' ) );
$style_attribute = $colors['inline_styles'] ? sprintf( ' style="%s"', esc_attr( $colors['inline_styles'] ) ) : '';
$colors = build_css_colors( $attributes );
$classes = array( 'wp-block-navigation', $colors['css_classes'] );
if ( ! empty( $attributes['className'] ) ) {
$classes[] = $attributes['className'];
}
$classes = join( ' ', array_filter( $classes ) );

return sprintf(
implode(
"\n",
array(
'<nav%s%s>',
' %s',
'</nav>',
)
),
$class_attribute,
$style_attribute,
'<nav class="%1$s" %2$s>%3$s</nav>',
esc_attr( $classes ),
$colors['inline_styles'] ? sprintf( 'style="%s"', esc_attr( $colors['inline_styles'] ) ) : '',
build_navigation_html( $block, $colors )
);
}
Expand Down

0 comments on commit c79b5d9

Please sign in to comment.