Make WordPress Core


Ignore:
Timestamp:
10/20/2020 01:33:02 PM (4 years ago)
Author:
youknowriad
Message:

Block Editor: Update the WordPress Packages to the latest version.

This includes the packages that match the Gutenberg 9.2 Release.
It is going to be the last block-editor features update for WordPress 5.6.
It also updates the block-supports code base to the latest APIs.

Props isabel_brison, noisysocks, desrosj.
Fixes #51570.

File:
1 edited

Legend:

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

    r49135 r49226  
    88/**
    99 * Registers the custom classname block attribute for block types that support it.
     10 *
     11 * @access private
    1012 *
    1113 * @param WP_Block_Type $block_type Block Type.
     
    3234 * Add the custom classnames to the output.
    3335 *
    34  * @param  array         $attributes       Comprehensive list of attributes to be applied.
     36 * @access private
     37 *
     38 * @param  WP_Block_Type $block_type       Block Type.
    3539 * @param  array         $block_attributes Block attributes.
    36  * @param  WP_Block_Type $block_type       Block Type.
    3740 *
    3841 * @return array Block CSS classes and inline styles.
    3942 */
    40 function wp_apply_custom_classname_support( $attributes, $block_attributes, $block_type ) {
     43function wp_apply_custom_classname_support( $block_type, $block_attributes ) {
    4144    $has_custom_classname_support = true;
     45    $attributes                   = array();
    4246    if ( property_exists( $block_type, 'supports' ) ) {
    4347        $has_custom_classname_support = wp_array_get( $block_type->supports, array( 'customClassName' ), true );
     
    4751
    4852        if ( $has_custom_classnames ) {
    49             $attributes['css_classes'][] = $block_attributes['className'];
     53            $attributes['class'] = $block_attributes['className'];
    5054        }
    5155    }
     
    5357    return $attributes;
    5458}
     59
     60// Register the block support.
     61WP_Block_Supports::get_instance()->register(
     62    'custom-classname',
     63    array(
     64        'register_attribute' => 'wp_register_custom_classname_support',
     65        'apply'              => 'wp_apply_custom_classname_support',
     66    )
     67);
Note: See TracChangeset for help on using the changeset viewer.