Make WordPress Core


Ignore:
Timestamp:
05/19/2021 03:07:55 PM (4 years ago)
Author:
gziolo
Message:

Editor: Update WordPress packages published for Gutenberg 10.6

It contains several changes in addition to regular update to WordPress packages:

  • All newly exposed blocks are now registered on the server.
  • Dutone block support was added.
  • Border block support was updated.
  • New shared function construct_wp_query_args was added for the family of Query blocks - it might need some further work.

Props youknowriad.
See #52991.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/border.php

    r50824 r50929  
    1919    // Determine if any border related features are supported.
    2020    $has_border_support       = block_has_support( $block_type, array( '__experimentalBorder' ) );
    21     $has_border_color_support = block_has_support( $block_type, array( '__experimentalBorder', 'color' ) );
     21    $has_border_color_support = wp_has_border_feature_support( $block_type, 'color' );
    2222
    2323    // Setup attributes and styles within that if needed.
     
    6161    // Border radius.
    6262    if (
    63         block_has_support( $block_type, array( '__experimentalBorder', 'radius' ) ) &&
     63        wp_has_border_feature_support( $block_type, 'radius' ) &&
    6464        isset( $block_attributes['style']['border']['radius'] )
    6565    ) {
     
    7070    // Border style.
    7171    if (
    72         block_has_support( $block_type, array( '__experimentalBorder', 'style' ) ) &&
     72        wp_has_border_feature_support( $block_type, 'style' ) &&
    7373        isset( $block_attributes['style']['border']['style'] )
    7474    ) {
     
    7979    // Border width.
    8080    if (
    81         block_has_support( $block_type, array( '__experimentalBorder', 'width' ) ) &&
     81        wp_has_border_feature_support( $block_type, 'width' ) &&
    8282        isset( $block_attributes['style']['border']['width'] )
    8383    ) {
     
    8787
    8888    // Border color.
    89     if ( block_has_support( $block_type, array( '__experimentalBorder', 'color' ) ) ) {
     89    if ( wp_has_border_feature_support( $block_type, 'color' ) ) {
    9090        $has_named_border_color  = array_key_exists( 'borderColor', $block_attributes );
    9191        $has_custom_border_color = isset( $block_attributes['style']['border']['color'] );
     
    136136}
    137137
     138/**
     139 * Checks whether the current block type supports the border feature requested.
     140 *
     141 * If the `__experimentalBorder` support flag is a boolean `true` all border
     142 * support features are available. Otherwise, the specific feature's support
     143 * flag nested under `experimentalBorder` must be enabled for the feature
     144 * to be opted into.
     145 *
     146 * @since 5.8.0
     147 * @access private
     148 *
     149 * @param WP_Block_Type $block_type Block type to check for support.
     150 * @param string        $feature    Name of the feature to check support for.
     151 * @param mixed         $default    Fallback value for feature support, defaults to false.
     152 *
     153 * @return boolean Whether or not the feature is supported.
     154 */
     155function wp_has_border_feature_support( $block_type, $feature, $default = false ) {
     156    // Check if all border support features have been opted into via `"__experimentalBorder": true`.
     157    if (
     158        property_exists( $block_type, 'supports' ) &&
     159        ( true === _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), $default ) )
     160    ) {
     161        return true;
     162    }
     163
     164    // Check if the specific feature has been opted into individually
     165    // via nested flag under `__experimentalBorder`.
     166    return block_has_support( $block_type, array( '__experimentalBorder', $feature ), $default );
     167}
     168
    138169// Register the block support.
    139170WP_Block_Supports::get_instance()->register(
Note: See TracChangeset for help on using the changeset viewer.