Skip to content

Commit

Permalink
Fix PHP linting
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Mar 31, 2020
1 parent 824566b commit 011d0ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
17 changes: 4 additions & 13 deletions packages/block-library/src/navigation-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,15 @@ function render_block_core_navigation_link( $content, $block ) {
// block rendering using the render_block filter. It does this to gain access to
// innerBlocks, but at the same time this bypasses prepare_attributes_for_render.
$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
$attributes = $block_type->prepare_attributes_for_render( $block[ 'attrs' ] );
$attributes = $block_type->prepare_attributes_for_render( $block['attrs'] );

// Don't render the block's subtree if it has no label.
if ( empty( $attributes['label'] ) ) {
return '';
}

// TODO Font sizes and colors were previously specified on the Navigation Link
// $classes = array_merge(
// $colors['css_classes'],
// $font_sizes['css_classes']
// );
// $classes[] = 'wp-block-navigation-link';
// $style_attribute = ( $colors['inline_styles'] || $font_sizes['inline_styles'] )
// ? sprintf( ' style="%s"', esc_attr( $colors['inline_styles'] ) . esc_attr( $font_sizes['inline_styles'] ) )
// : '';

// TODO $classes and $style_attribute below are temporary until font sizes and colors are working again.
// TODO $classes and $style_attribute below are temporary. Ideally the Navigation Block would
// have some way of passing its attributes to the Navigation Link so that these continue to work.
$classes = array( 'wp-block-navigation-link' );
$style_attribute = '';

Expand Down Expand Up @@ -163,7 +154,7 @@ function register_block_core_navigation_link() {
'type' => 'string',
),
),
),
)
);
}
add_action( 'init', 'register_block_core_navigation_link' );
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 @@ -112,7 +112,7 @@ function render_block_core_navigation( $content, $block ) {
// block rendering using the render_block filter. It does this to gain access to
// innerBlocks, but at the same time this bypasses prepare_attributes_for_render.
$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
$attributes = $block_type->prepare_attributes_for_render( $block[ 'attrs' ] );
$attributes = $block_type->prepare_attributes_for_render( $block['attrs'] );

/**
* Deprecated:
Expand Down Expand Up @@ -144,7 +144,7 @@ function render_block_core_navigation( $content, $block ) {
isset( $attributes['className'] ) ? array( $attributes['className'] ) : array(),
isset( $attributes['itemsJustification'] ) ? array( 'items-justified-' . $attributes['itemsJustification'] ) : array(),
isset( $attributes['align'] ) ? array( 'align' . $attributes['align'] ) : array(),
isset( $attributes['showSubmenuIcon'] ) && $attributes['showSubmenuIcon'] ? array( 'has-submenu-icon' ) : array(),
isset( $attributes['showSubmenuIcon'] ) && $attributes['showSubmenuIcon'] ? array( 'has-submenu-icon' ) : array()
);
$class_attribute = sprintf( ' class="%s"', esc_attr( implode( ' ', $classes ) ) );
$style_attribute = ( $colors['inline_styles'] || $font_sizes['inline_styles'] )
Expand Down

0 comments on commit 011d0ac

Please sign in to comment.