Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoids polluting Layout functionality with Query Pagination specific requirements. #37113

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,11 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) {
$id = uniqid();
$style = gutenberg_get_layout_style( ".wp-container-$id", $used_layout, $has_block_gap_support );
$container_class = 'wp-container-' . $id . ' ';
$justify_class = $used_layout['justifyContent'] ? 'wp-justify-' . $used_layout['justifyContent'] . ' ' : '';
// This assumes the hook only applies to blocks with a single wrapper.
// I think this is a reasonable limitation for that particular hook.
$content = preg_replace(
'/' . preg_quote( 'class="', '/' ) . '/',
'class="' . $container_class . $justify_class,
'class="' . $container_class,
$block_content,
1
);
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/query-pagination/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ function render_block_core_query_pagination( $attributes, $content ) {
return '';
}

$justify_content = $attributes['layout']['justifyContent'];
$justify_class = isset( $justify_content ) ? 'wp-justify-' . $justify_content : '';

return sprintf(
'<div %1$s>%2$s</div>',
get_block_wrapper_attributes(),
get_block_wrapper_attributes( array( 'class' => $justify_class ) ),
$content
);
}
Expand Down