mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 17:48:01 +01:00
4939393799
Update packages with these bug fixes from Gutenberg: Navigation: Remove hardcoded typography units Handle parsed request Navigation: Refactor modal padding to be simpler and more flexible Show notice on save in site editor Add aria-pressed true/false to Toggle navigation button based on state Components FontSizePicker: Use incremental sequence of numbers Custom keys from theme.json: fix kebabCase conversion Template Part: Fix 'isMissing' condition check Multi-Entity Saving: Decode HTML entities in item titles Font sizes: update default values Query Loop: Add useBlockPreview, fix Query Loop wide alignment Only add dialog role to navigation when modal is open Fix navigation appender Show a UI warning when user does not have permission to update/edit a Navigation block Block editor: Fix Enter handling for nested blocks Update: Use subtitle styles for the palette names Allow publishing a post while not saving changes to non-post entities Update: Block top level useSetting paths Fix Site Logo block alignment issues Editor: when Toggle navigation receives state false, focus ToolsPanel: Allow items to register when panelId is null Block Support Panels - Make block support tools panels compatible Gallery: Fix block registration hook priority Navigation: Fix page list issues in overlay Ensure the overlay menu works when inserting navigation block pattern Restrict Navigation permissions and show UI warning if cannot create Add block gap support for group blocks Try cascading nav styles through classnames Fix: Impossible to edit theme and default colors Fix: Color editor discards colors with default name Site Editor: Fix template author avatar check Template Editing Mode: Fix options dropdown Avoid undo issues when reset parent blocks for controlled blocks Add comment-form and comment-list to html5 theme support and fix comment layout Props hellofromtonya. See #54487. Built from https://develop.svn.wordpress.org/trunk@52402 git-svn-id: http://core.svn.wordpress.org/trunk@51994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* Server-side rendering of the `core/gallery` block.
|
|
*
|
|
* @package WordPress
|
|
*/
|
|
|
|
/**
|
|
* Handles backwards compatibility for Gallery Blocks,
|
|
* whose images feature a `data-id` attribute.
|
|
*
|
|
* Now that the Gallery Block contains inner Image Blocks,
|
|
* we add a custom `data-id` attribute before rendering the gallery
|
|
* so that the Image Block can pick it up in its render_callback.
|
|
*
|
|
* @param array $parsed_block The block being rendered.
|
|
* @return array The migrated block object.
|
|
*/
|
|
function block_core_gallery_data_id_backcompatibility( $parsed_block ) {
|
|
if ( 'core/gallery' === $parsed_block['blockName'] ) {
|
|
foreach ( $parsed_block['innerBlocks'] as $key => $inner_block ) {
|
|
if ( 'core/image' === $inner_block['blockName'] ) {
|
|
if ( ! isset( $parsed_block['innerBlocks'][ $key ]['attrs']['data-id'] ) && isset( $inner_block['attrs']['id'] ) ) {
|
|
$parsed_block['innerBlocks'][ $key ]['attrs']['data-id'] = esc_attr( $inner_block['attrs']['id'] );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return $parsed_block;
|
|
}
|
|
|
|
add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' );
|
|
|
|
/**
|
|
* Registers the `core/gallery` block on server.
|
|
* This render callback needs to be here
|
|
* so that the gallery styles are loaded in block-based themes.
|
|
*/
|
|
function register_block_core_gallery() {
|
|
register_block_type_from_metadata(
|
|
__DIR__ . '/gallery',
|
|
array(
|
|
'render_callback' => function ( $attributes, $content ) {
|
|
return $content;
|
|
},
|
|
)
|
|
);
|
|
}
|
|
|
|
add_action( 'init', 'register_block_core_gallery' );
|