WordPress/wp-includes/blocks/gallery.php

133 lines
4.8 KiB
PHP
Raw Normal View History

Update @wordpress packages Update packages to include these bug fixes from Gutenberg: - Image block: Set image display to grid when no alignment sent to properly align caption on resize - Update and align template descriptions - Site Editor - prevent loading state from showing the admin menu. - Add client side routing for Site Editor - Navigation: Add clearance for appender in submenus. - Fix CSS Custom Properties for presets in the site editor - Add/navigation blocks post processing after migration from menu items - Allow selector ordering to ensure theme.json root selector margin takes precedence - Do not remove theme presets if defaults are hidden - Format library: fix unsetting highlight color - FSE: Fix template resolution to give precedence to child theme PHP templates over parent theme block templates with equal specificity - ColorPalette: Improving accessibility and visibility - Update: Make the color popover on the gradient picker appear as expected - Site Editor: Display a notice if export fails - Fix docs and function naming for gallery block registration in PHP - Switch to addEventListener for load event in the navigation block view script - Fix mistake in _remove_theme_attribute_in_block_template_content - Better synchronisation between Gutenberg and Core code - Move the block page templates hook into compat/5.9 folder - Moves to the template loader hooks and functions into lib/compat folder - Refactor the gutenberg_is_fse_theme function to use wp_is_block_theme - Site Editor: Update support doc URL in Welcome Guide - Global Styles: Add Welcome Guide toggle - Hide remove control point when removing would break gradient control - Don't request the deprecated navigation areas endpoint outside of the Gutenberg plugin - Image: Fix resizer controls being hidden in Safari when switching between alignments - Remove Navigation Menus from WP Admin sidebar - Site Editor: Hide the block appender in the Template Part editor - Site Editor: Use server definition for the Template Areas - Synchronize wp_is_block_theme and block-templates block support with Core - E2E: Retry login again after a bad nonce request to prevent intermittent test failures - Fix theme requirement validation with WP 5.8 - Fix WP 5.9 check for conditionally running code - Fix post comment form input width - Border Style Control: Update styling for consistency with border width control - Fix form-submit styles by adding button classes to the submit-button in post-comments block - Site Editor: Fix edit template part link in header dropdown - Move duotone palette to the bottom of global styles gradients - Fix how appearanceTools works - Move WP 5.9 wp-admin menus compatibility code to lib/compat folder - Revert "Site Editor: Set the <title> on the list page to be same as the CPT name" - Site Editor: Document Actions: add SR text to heading 1 - Do not register global styles CPT in WordPress 5.9 - Global Styles: Move the 'Edit colors' button to a standard menu item - Fix styles for previews and patterns - Site Editor: Fix failing E2E test - Templates: Search for old template names in the parent theme too - Remove 4 instances of 'gutenberg' text domain from WordPress core - Fix content loss when ungrouping template parts or reusable blocks - Simplify the RESET_BLOCK action to fix template part focus mode content loss - [Global Styles]: Make Blocks section more distinguishable - Only use block markup for comment form button when using a block theme - Navigation: Fix vertical alignment of page list in modal. - Fix: ToggleGroupControl active state - Remove gutenberg_ prefix from @wordpress/block-library Props ocean90, oandregal, hellofromtonya, youknowriad. See #54487. Built from https://develop.svn.wordpress.org/trunk@52364 git-svn-id: http://core.svn.wordpress.org/trunk@51956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 02:57:26 +01:00
<?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' );
/**
* Adds a style tag for the --wp--style--unstable-gallery-gap var.
*
* The Gallery block needs to recalculate Image block width based on
* the current gap setting in order to maintain the number of flex columns
* so a css var is added to allow this.
*
* @param array $attributes Attributes of the block being rendered.
* @param string $content Content of the block being rendered.
* @return string The content of the block being rendered.
*/
function block_core_gallery_render( $attributes, $content ) {
$gap = $attributes['style']['spacing']['blockGap'] ?? null;
// Skip if gap value contains unsupported characters.
// Regex for CSS value borrowed from `safecss_filter_attr`, and used here
// because we only want to match against the value, not the CSS attribute.
if ( is_array( $gap ) ) {
foreach ( $gap as $key => $value ) {
Editor: Sync changes from the Gutenberg plugin 14.1 release Updated WordPress packages necessary for releasing WordPress 6.1 Beta 1: - @wordpress/a11y@3.17.1 - @wordpress/annotations@2.17.2 - @wordpress/api-fetch@6.14.1 - @wordpress/autop@3.17.1 - @wordpress/babel-plugin-import-jsx-pragma@4.0.1 - @wordpress/babel-plugin-makepot@5.1.1 - @wordpress/babel-preset-default@7.1.1 - @wordpress/base-styles@4.8.1 - @wordpress/blob@3.17.1 - @wordpress/block-directory@3.15.2 - @wordpress/block-editor@10.0.2 - @wordpress/block-library@7.14.2 - @wordpress/block-serialization-default-parser@4.17.1 - @wordpress/block-serialization-spec-parser@4.17.1 - @wordpress/blocks@11.16.2 - @wordpress/browserslist-config@5.0.1 - @wordpress/components@21.0.2 - @wordpress/compose@5.15.2 - @wordpress/core-data@5.0.2 - @wordpress/create-block-tutorial-template@2.5.1 - @wordpress/create-block@4.1.1 - @wordpress/custom-templated-path-webpack-plugin@2.1.3 - @wordpress/customize-widgets@3.14.2 - @wordpress/data-controls@2.17.2 - @wordpress/data@7.1.2 - @wordpress/date@4.17.1 - @wordpress/dependency-extraction-webpack-plugin@4.0.2 - @wordpress/deprecated@3.17.1 - @wordpress/docgen@1.26.1 - @wordpress/dom-ready@3.17.1 - @wordpress/dom@3.17.2 - @wordpress/e2e-test-utils@8.1.1 - @wordpress/e2e-tests@5.1.2 - @wordpress/edit-post@6.14.2 - @wordpress/edit-site@4.14.2 - @wordpress/edit-widgets@4.14.2 - @wordpress/editor@12.16.2 - @wordpress/element@4.15.1 - @wordpress/env@5.2.1 - @wordpress/escape-html@2.17.1 - @wordpress/eslint-plugin@13.1.1 - @wordpress/format-library@3.15.2 - @wordpress/hooks@3.17.1 - @wordpress/html-entities@3.17.1 - @wordpress/i18n@4.17.1 - @wordpress/icons@9.8.1 - @wordpress/interface@4.16.2 - @wordpress/is-shallow-equal@4.17.1 - @wordpress/jest-console@6.0.1 - @wordpress/jest-preset-default@9.0.1 - @wordpress/jest-puppeteer-axe@5.0.1 - @wordpress/keyboard-shortcuts@3.15.2 - @wordpress/keycodes@3.17.1 - @wordpress/lazy-import@1.4.3 - @wordpress/library-export-default-webpack-plugin@2.3.3 - @wordpress/list-reusable-blocks@3.15.2 - @wordpress/media-utils@4.8.1 - @wordpress/notices@3.17.2 - @wordpress/npm-package-json-lint-config@4.2.1 - @wordpress/nux@5.15.2 - @wordpress/plugins@4.15.2 - @wordpress/postcss-plugins-preset@4.1.1 - @wordpress/postcss-themes@5.0.1 - @wordpress/preferences-persistence@1.9.1 - @wordpress/preferences@2.9.2 - @wordpress/prettier-config@2.0.1 - @wordpress/primitives@3.15.1 - @wordpress/priority-queue@2.17.2 - @wordpress/project-management-automation@1.16.1 - @wordpress/react-i18n@3.15.1 - @wordpress/readable-js-assets-webpack-plugin@2.0.1 - @wordpress/redux-routine@4.17.1 - @wordpress/reusable-blocks@3.15.2 - @wordpress/rich-text@5.15.2 - @wordpress/scripts@24.1.2 - @wordpress/server-side-render@3.15.2 - @wordpress/shortcode@3.17.1 - @wordpress/style-engine@1.0.1 - @wordpress/stylelint-config@21.0.1 - @wordpress/token-list@2.17.1 - @wordpress/url@3.18.1 - @wordpress/viewport@4.15.2 - @wordpress/warning@2.17.1 - @wordpress/widgets@2.15.2 - @wordpress/wordcount@3.17.1 Props bernhard-reiter, cbravobernal, czapla, oandregal, isabel_brison, andrewserong, mciampini. See #56467. Built from https://develop.svn.wordpress.org/trunk@54257 git-svn-id: http://core.svn.wordpress.org/trunk@53816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 17:43:29 +02:00
// Make sure $value is a string to avoid PHP 8.1 deprecation error in preg_match() when the value is null.
$value = is_string( $value ) ? $value : '';
$value = $value && preg_match( '%[\\\(&=}]|/\*%', $value ) ? null : $value;
// Get spacing CSS variable from preset value if provided.
if ( is_string( $value ) && str_contains( $value, 'var:preset|spacing|' ) ) {
$index_to_splice = strrpos( $value, '|' ) + 1;
$slug = _wp_to_kebab_case( substr( $value, $index_to_splice ) );
$value = "var(--wp--preset--spacing--$slug)";
}
$gap[ $key ] = $value;
}
} else {
Editor: Sync changes from the Gutenberg plugin 14.1 release Updated WordPress packages necessary for releasing WordPress 6.1 Beta 1: - @wordpress/a11y@3.17.1 - @wordpress/annotations@2.17.2 - @wordpress/api-fetch@6.14.1 - @wordpress/autop@3.17.1 - @wordpress/babel-plugin-import-jsx-pragma@4.0.1 - @wordpress/babel-plugin-makepot@5.1.1 - @wordpress/babel-preset-default@7.1.1 - @wordpress/base-styles@4.8.1 - @wordpress/blob@3.17.1 - @wordpress/block-directory@3.15.2 - @wordpress/block-editor@10.0.2 - @wordpress/block-library@7.14.2 - @wordpress/block-serialization-default-parser@4.17.1 - @wordpress/block-serialization-spec-parser@4.17.1 - @wordpress/blocks@11.16.2 - @wordpress/browserslist-config@5.0.1 - @wordpress/components@21.0.2 - @wordpress/compose@5.15.2 - @wordpress/core-data@5.0.2 - @wordpress/create-block-tutorial-template@2.5.1 - @wordpress/create-block@4.1.1 - @wordpress/custom-templated-path-webpack-plugin@2.1.3 - @wordpress/customize-widgets@3.14.2 - @wordpress/data-controls@2.17.2 - @wordpress/data@7.1.2 - @wordpress/date@4.17.1 - @wordpress/dependency-extraction-webpack-plugin@4.0.2 - @wordpress/deprecated@3.17.1 - @wordpress/docgen@1.26.1 - @wordpress/dom-ready@3.17.1 - @wordpress/dom@3.17.2 - @wordpress/e2e-test-utils@8.1.1 - @wordpress/e2e-tests@5.1.2 - @wordpress/edit-post@6.14.2 - @wordpress/edit-site@4.14.2 - @wordpress/edit-widgets@4.14.2 - @wordpress/editor@12.16.2 - @wordpress/element@4.15.1 - @wordpress/env@5.2.1 - @wordpress/escape-html@2.17.1 - @wordpress/eslint-plugin@13.1.1 - @wordpress/format-library@3.15.2 - @wordpress/hooks@3.17.1 - @wordpress/html-entities@3.17.1 - @wordpress/i18n@4.17.1 - @wordpress/icons@9.8.1 - @wordpress/interface@4.16.2 - @wordpress/is-shallow-equal@4.17.1 - @wordpress/jest-console@6.0.1 - @wordpress/jest-preset-default@9.0.1 - @wordpress/jest-puppeteer-axe@5.0.1 - @wordpress/keyboard-shortcuts@3.15.2 - @wordpress/keycodes@3.17.1 - @wordpress/lazy-import@1.4.3 - @wordpress/library-export-default-webpack-plugin@2.3.3 - @wordpress/list-reusable-blocks@3.15.2 - @wordpress/media-utils@4.8.1 - @wordpress/notices@3.17.2 - @wordpress/npm-package-json-lint-config@4.2.1 - @wordpress/nux@5.15.2 - @wordpress/plugins@4.15.2 - @wordpress/postcss-plugins-preset@4.1.1 - @wordpress/postcss-themes@5.0.1 - @wordpress/preferences-persistence@1.9.1 - @wordpress/preferences@2.9.2 - @wordpress/prettier-config@2.0.1 - @wordpress/primitives@3.15.1 - @wordpress/priority-queue@2.17.2 - @wordpress/project-management-automation@1.16.1 - @wordpress/react-i18n@3.15.1 - @wordpress/readable-js-assets-webpack-plugin@2.0.1 - @wordpress/redux-routine@4.17.1 - @wordpress/reusable-blocks@3.15.2 - @wordpress/rich-text@5.15.2 - @wordpress/scripts@24.1.2 - @wordpress/server-side-render@3.15.2 - @wordpress/shortcode@3.17.1 - @wordpress/style-engine@1.0.1 - @wordpress/stylelint-config@21.0.1 - @wordpress/token-list@2.17.1 - @wordpress/url@3.18.1 - @wordpress/viewport@4.15.2 - @wordpress/warning@2.17.1 - @wordpress/widgets@2.15.2 - @wordpress/wordcount@3.17.1 Props bernhard-reiter, cbravobernal, czapla, oandregal, isabel_brison, andrewserong, mciampini. See #56467. Built from https://develop.svn.wordpress.org/trunk@54257 git-svn-id: http://core.svn.wordpress.org/trunk@53816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 17:43:29 +02:00
// Make sure $gap is a string to avoid PHP 8.1 deprecation error in preg_match() when the value is null.
$gap = is_string( $gap ) ? $gap : '';
$gap = $gap && preg_match( '%[\\\(&=}]|/\*%', $gap ) ? null : $gap;
Editor: Sync changes from the Gutenberg plugin 14.1 release Updated WordPress packages necessary for releasing WordPress 6.1 Beta 1: - @wordpress/a11y@3.17.1 - @wordpress/annotations@2.17.2 - @wordpress/api-fetch@6.14.1 - @wordpress/autop@3.17.1 - @wordpress/babel-plugin-import-jsx-pragma@4.0.1 - @wordpress/babel-plugin-makepot@5.1.1 - @wordpress/babel-preset-default@7.1.1 - @wordpress/base-styles@4.8.1 - @wordpress/blob@3.17.1 - @wordpress/block-directory@3.15.2 - @wordpress/block-editor@10.0.2 - @wordpress/block-library@7.14.2 - @wordpress/block-serialization-default-parser@4.17.1 - @wordpress/block-serialization-spec-parser@4.17.1 - @wordpress/blocks@11.16.2 - @wordpress/browserslist-config@5.0.1 - @wordpress/components@21.0.2 - @wordpress/compose@5.15.2 - @wordpress/core-data@5.0.2 - @wordpress/create-block-tutorial-template@2.5.1 - @wordpress/create-block@4.1.1 - @wordpress/custom-templated-path-webpack-plugin@2.1.3 - @wordpress/customize-widgets@3.14.2 - @wordpress/data-controls@2.17.2 - @wordpress/data@7.1.2 - @wordpress/date@4.17.1 - @wordpress/dependency-extraction-webpack-plugin@4.0.2 - @wordpress/deprecated@3.17.1 - @wordpress/docgen@1.26.1 - @wordpress/dom-ready@3.17.1 - @wordpress/dom@3.17.2 - @wordpress/e2e-test-utils@8.1.1 - @wordpress/e2e-tests@5.1.2 - @wordpress/edit-post@6.14.2 - @wordpress/edit-site@4.14.2 - @wordpress/edit-widgets@4.14.2 - @wordpress/editor@12.16.2 - @wordpress/element@4.15.1 - @wordpress/env@5.2.1 - @wordpress/escape-html@2.17.1 - @wordpress/eslint-plugin@13.1.1 - @wordpress/format-library@3.15.2 - @wordpress/hooks@3.17.1 - @wordpress/html-entities@3.17.1 - @wordpress/i18n@4.17.1 - @wordpress/icons@9.8.1 - @wordpress/interface@4.16.2 - @wordpress/is-shallow-equal@4.17.1 - @wordpress/jest-console@6.0.1 - @wordpress/jest-preset-default@9.0.1 - @wordpress/jest-puppeteer-axe@5.0.1 - @wordpress/keyboard-shortcuts@3.15.2 - @wordpress/keycodes@3.17.1 - @wordpress/lazy-import@1.4.3 - @wordpress/library-export-default-webpack-plugin@2.3.3 - @wordpress/list-reusable-blocks@3.15.2 - @wordpress/media-utils@4.8.1 - @wordpress/notices@3.17.2 - @wordpress/npm-package-json-lint-config@4.2.1 - @wordpress/nux@5.15.2 - @wordpress/plugins@4.15.2 - @wordpress/postcss-plugins-preset@4.1.1 - @wordpress/postcss-themes@5.0.1 - @wordpress/preferences-persistence@1.9.1 - @wordpress/preferences@2.9.2 - @wordpress/prettier-config@2.0.1 - @wordpress/primitives@3.15.1 - @wordpress/priority-queue@2.17.2 - @wordpress/project-management-automation@1.16.1 - @wordpress/react-i18n@3.15.1 - @wordpress/readable-js-assets-webpack-plugin@2.0.1 - @wordpress/redux-routine@4.17.1 - @wordpress/reusable-blocks@3.15.2 - @wordpress/rich-text@5.15.2 - @wordpress/scripts@24.1.2 - @wordpress/server-side-render@3.15.2 - @wordpress/shortcode@3.17.1 - @wordpress/style-engine@1.0.1 - @wordpress/stylelint-config@21.0.1 - @wordpress/token-list@2.17.1 - @wordpress/url@3.18.1 - @wordpress/viewport@4.15.2 - @wordpress/warning@2.17.1 - @wordpress/widgets@2.15.2 - @wordpress/wordcount@3.17.1 Props bernhard-reiter, cbravobernal, czapla, oandregal, isabel_brison, andrewserong, mciampini. See #56467. Built from https://develop.svn.wordpress.org/trunk@54257 git-svn-id: http://core.svn.wordpress.org/trunk@53816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 17:43:29 +02:00
// Get spacing CSS variable from preset value if provided.
if ( is_string( $gap ) && str_contains( $gap, 'var:preset|spacing|' ) ) {
$index_to_splice = strrpos( $gap, '|' ) + 1;
$slug = _wp_to_kebab_case( substr( $gap, $index_to_splice ) );
$gap = "var(--wp--preset--spacing--$slug)";
}
}
$unique_gallery_classname = wp_unique_id( 'wp-block-gallery-' );
$processed_content = new WP_HTML_Tag_Processor( $content );
$processed_content->next_tag();
$processed_content->add_class( $unique_gallery_classname );
// --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default
// gap on the gallery.
$fallback_gap = 'var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )';
$gap_value = $gap ? $gap : $fallback_gap;
$gap_column = $gap_value;
if ( is_array( $gap_value ) ) {
$gap_row = isset( $gap_value['top'] ) ? $gap_value['top'] : $fallback_gap;
$gap_column = isset( $gap_value['left'] ) ? $gap_value['left'] : $fallback_gap;
$gap_value = $gap_row === $gap_column ? $gap_row : $gap_row . ' ' . $gap_column;
}
Editor: Sync changes from the Gutenberg plugin 14.1 release Updated WordPress packages necessary for releasing WordPress 6.1 Beta 1: - @wordpress/a11y@3.17.1 - @wordpress/annotations@2.17.2 - @wordpress/api-fetch@6.14.1 - @wordpress/autop@3.17.1 - @wordpress/babel-plugin-import-jsx-pragma@4.0.1 - @wordpress/babel-plugin-makepot@5.1.1 - @wordpress/babel-preset-default@7.1.1 - @wordpress/base-styles@4.8.1 - @wordpress/blob@3.17.1 - @wordpress/block-directory@3.15.2 - @wordpress/block-editor@10.0.2 - @wordpress/block-library@7.14.2 - @wordpress/block-serialization-default-parser@4.17.1 - @wordpress/block-serialization-spec-parser@4.17.1 - @wordpress/blocks@11.16.2 - @wordpress/browserslist-config@5.0.1 - @wordpress/components@21.0.2 - @wordpress/compose@5.15.2 - @wordpress/core-data@5.0.2 - @wordpress/create-block-tutorial-template@2.5.1 - @wordpress/create-block@4.1.1 - @wordpress/custom-templated-path-webpack-plugin@2.1.3 - @wordpress/customize-widgets@3.14.2 - @wordpress/data-controls@2.17.2 - @wordpress/data@7.1.2 - @wordpress/date@4.17.1 - @wordpress/dependency-extraction-webpack-plugin@4.0.2 - @wordpress/deprecated@3.17.1 - @wordpress/docgen@1.26.1 - @wordpress/dom-ready@3.17.1 - @wordpress/dom@3.17.2 - @wordpress/e2e-test-utils@8.1.1 - @wordpress/e2e-tests@5.1.2 - @wordpress/edit-post@6.14.2 - @wordpress/edit-site@4.14.2 - @wordpress/edit-widgets@4.14.2 - @wordpress/editor@12.16.2 - @wordpress/element@4.15.1 - @wordpress/env@5.2.1 - @wordpress/escape-html@2.17.1 - @wordpress/eslint-plugin@13.1.1 - @wordpress/format-library@3.15.2 - @wordpress/hooks@3.17.1 - @wordpress/html-entities@3.17.1 - @wordpress/i18n@4.17.1 - @wordpress/icons@9.8.1 - @wordpress/interface@4.16.2 - @wordpress/is-shallow-equal@4.17.1 - @wordpress/jest-console@6.0.1 - @wordpress/jest-preset-default@9.0.1 - @wordpress/jest-puppeteer-axe@5.0.1 - @wordpress/keyboard-shortcuts@3.15.2 - @wordpress/keycodes@3.17.1 - @wordpress/lazy-import@1.4.3 - @wordpress/library-export-default-webpack-plugin@2.3.3 - @wordpress/list-reusable-blocks@3.15.2 - @wordpress/media-utils@4.8.1 - @wordpress/notices@3.17.2 - @wordpress/npm-package-json-lint-config@4.2.1 - @wordpress/nux@5.15.2 - @wordpress/plugins@4.15.2 - @wordpress/postcss-plugins-preset@4.1.1 - @wordpress/postcss-themes@5.0.1 - @wordpress/preferences-persistence@1.9.1 - @wordpress/preferences@2.9.2 - @wordpress/prettier-config@2.0.1 - @wordpress/primitives@3.15.1 - @wordpress/priority-queue@2.17.2 - @wordpress/project-management-automation@1.16.1 - @wordpress/react-i18n@3.15.1 - @wordpress/readable-js-assets-webpack-plugin@2.0.1 - @wordpress/redux-routine@4.17.1 - @wordpress/reusable-blocks@3.15.2 - @wordpress/rich-text@5.15.2 - @wordpress/scripts@24.1.2 - @wordpress/server-side-render@3.15.2 - @wordpress/shortcode@3.17.1 - @wordpress/style-engine@1.0.1 - @wordpress/stylelint-config@21.0.1 - @wordpress/token-list@2.17.1 - @wordpress/url@3.18.1 - @wordpress/viewport@4.15.2 - @wordpress/warning@2.17.1 - @wordpress/widgets@2.15.2 - @wordpress/wordcount@3.17.1 Props bernhard-reiter, cbravobernal, czapla, oandregal, isabel_brison, andrewserong, mciampini. See #56467. Built from https://develop.svn.wordpress.org/trunk@54257 git-svn-id: http://core.svn.wordpress.org/trunk@53816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 17:43:29 +02:00
// The unstable gallery gap calculation requires a real value (such as `0px`) and not `0`.
if ( '0' === $gap_column ) {
$gap_column = '0px';
}
// Set the CSS variable to the column value, and the `gap` property to the combined gap value.
$gallery_styles = array(
array(
'selector' => ".wp-block-gallery.{$unique_gallery_classname}",
'declarations' => array(
'--wp--style--unstable-gallery-gap' => $gap_column,
'gap' => $gap_value,
),
),
);
wp_style_engine_get_stylesheet_from_css_rules(
$gallery_styles,
array(
'context' => 'block-supports',
)
);
return (string) $processed_content;
}
Update @wordpress packages Update packages to include these bug fixes from Gutenberg: - Image block: Set image display to grid when no alignment sent to properly align caption on resize - Update and align template descriptions - Site Editor - prevent loading state from showing the admin menu. - Add client side routing for Site Editor - Navigation: Add clearance for appender in submenus. - Fix CSS Custom Properties for presets in the site editor - Add/navigation blocks post processing after migration from menu items - Allow selector ordering to ensure theme.json root selector margin takes precedence - Do not remove theme presets if defaults are hidden - Format library: fix unsetting highlight color - FSE: Fix template resolution to give precedence to child theme PHP templates over parent theme block templates with equal specificity - ColorPalette: Improving accessibility and visibility - Update: Make the color popover on the gradient picker appear as expected - Site Editor: Display a notice if export fails - Fix docs and function naming for gallery block registration in PHP - Switch to addEventListener for load event in the navigation block view script - Fix mistake in _remove_theme_attribute_in_block_template_content - Better synchronisation between Gutenberg and Core code - Move the block page templates hook into compat/5.9 folder - Moves to the template loader hooks and functions into lib/compat folder - Refactor the gutenberg_is_fse_theme function to use wp_is_block_theme - Site Editor: Update support doc URL in Welcome Guide - Global Styles: Add Welcome Guide toggle - Hide remove control point when removing would break gradient control - Don't request the deprecated navigation areas endpoint outside of the Gutenberg plugin - Image: Fix resizer controls being hidden in Safari when switching between alignments - Remove Navigation Menus from WP Admin sidebar - Site Editor: Hide the block appender in the Template Part editor - Site Editor: Use server definition for the Template Areas - Synchronize wp_is_block_theme and block-templates block support with Core - E2E: Retry login again after a bad nonce request to prevent intermittent test failures - Fix theme requirement validation with WP 5.8 - Fix WP 5.9 check for conditionally running code - Fix post comment form input width - Border Style Control: Update styling for consistency with border width control - Fix form-submit styles by adding button classes to the submit-button in post-comments block - Site Editor: Fix edit template part link in header dropdown - Move duotone palette to the bottom of global styles gradients - Fix how appearanceTools works - Move WP 5.9 wp-admin menus compatibility code to lib/compat folder - Revert "Site Editor: Set the <title> on the list page to be same as the CPT name" - Site Editor: Document Actions: add SR text to heading 1 - Do not register global styles CPT in WordPress 5.9 - Global Styles: Move the 'Edit colors' button to a standard menu item - Fix styles for previews and patterns - Site Editor: Fix failing E2E test - Templates: Search for old template names in the parent theme too - Remove 4 instances of 'gutenberg' text domain from WordPress core - Fix content loss when ungrouping template parts or reusable blocks - Simplify the RESET_BLOCK action to fix template part focus mode content loss - [Global Styles]: Make Blocks section more distinguishable - Only use block markup for comment form button when using a block theme - Navigation: Fix vertical alignment of page list in modal. - Fix: ToggleGroupControl active state - Remove gutenberg_ prefix from @wordpress/block-library Props ocean90, oandregal, hellofromtonya, youknowriad. See #54487. Built from https://develop.svn.wordpress.org/trunk@52364 git-svn-id: http://core.svn.wordpress.org/trunk@51956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 02:57:26 +01:00
/**
* Registers the `core/gallery` block on server.
*/
function register_block_core_gallery() {
register_block_type_from_metadata(
__DIR__ . '/gallery',
array(
'render_callback' => 'block_core_gallery_render',
Update @wordpress packages Update packages to include these bug fixes from Gutenberg: - Image block: Set image display to grid when no alignment sent to properly align caption on resize - Update and align template descriptions - Site Editor - prevent loading state from showing the admin menu. - Add client side routing for Site Editor - Navigation: Add clearance for appender in submenus. - Fix CSS Custom Properties for presets in the site editor - Add/navigation blocks post processing after migration from menu items - Allow selector ordering to ensure theme.json root selector margin takes precedence - Do not remove theme presets if defaults are hidden - Format library: fix unsetting highlight color - FSE: Fix template resolution to give precedence to child theme PHP templates over parent theme block templates with equal specificity - ColorPalette: Improving accessibility and visibility - Update: Make the color popover on the gradient picker appear as expected - Site Editor: Display a notice if export fails - Fix docs and function naming for gallery block registration in PHP - Switch to addEventListener for load event in the navigation block view script - Fix mistake in _remove_theme_attribute_in_block_template_content - Better synchronisation between Gutenberg and Core code - Move the block page templates hook into compat/5.9 folder - Moves to the template loader hooks and functions into lib/compat folder - Refactor the gutenberg_is_fse_theme function to use wp_is_block_theme - Site Editor: Update support doc URL in Welcome Guide - Global Styles: Add Welcome Guide toggle - Hide remove control point when removing would break gradient control - Don't request the deprecated navigation areas endpoint outside of the Gutenberg plugin - Image: Fix resizer controls being hidden in Safari when switching between alignments - Remove Navigation Menus from WP Admin sidebar - Site Editor: Hide the block appender in the Template Part editor - Site Editor: Use server definition for the Template Areas - Synchronize wp_is_block_theme and block-templates block support with Core - E2E: Retry login again after a bad nonce request to prevent intermittent test failures - Fix theme requirement validation with WP 5.8 - Fix WP 5.9 check for conditionally running code - Fix post comment form input width - Border Style Control: Update styling for consistency with border width control - Fix form-submit styles by adding button classes to the submit-button in post-comments block - Site Editor: Fix edit template part link in header dropdown - Move duotone palette to the bottom of global styles gradients - Fix how appearanceTools works - Move WP 5.9 wp-admin menus compatibility code to lib/compat folder - Revert "Site Editor: Set the <title> on the list page to be same as the CPT name" - Site Editor: Document Actions: add SR text to heading 1 - Do not register global styles CPT in WordPress 5.9 - Global Styles: Move the 'Edit colors' button to a standard menu item - Fix styles for previews and patterns - Site Editor: Fix failing E2E test - Templates: Search for old template names in the parent theme too - Remove 4 instances of 'gutenberg' text domain from WordPress core - Fix content loss when ungrouping template parts or reusable blocks - Simplify the RESET_BLOCK action to fix template part focus mode content loss - [Global Styles]: Make Blocks section more distinguishable - Only use block markup for comment form button when using a block theme - Navigation: Fix vertical alignment of page list in modal. - Fix: ToggleGroupControl active state - Remove gutenberg_ prefix from @wordpress/block-library Props ocean90, oandregal, hellofromtonya, youknowriad. See #54487. Built from https://develop.svn.wordpress.org/trunk@52364 git-svn-id: http://core.svn.wordpress.org/trunk@51956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 02:57:26 +01:00
)
);
}
Update @wordpress packages for Beta 4 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
2021-12-21 08:02:34 +01:00
add_action( 'init', 'register_block_core_gallery' );