WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/20/2020 01:33:02 PM (14 months 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/generated-classname.php

    r49135 r49226  
    88/**
    99 * Get the generated classname from a given block name.
     10 *
     11 * @access private
    1012 *
    1113 * @param  string $block_name Block Name.
     
    3537 * Add the generated classnames to the output.
    3638 *
    37  * @param  array         $attributes       Comprehensive list of attributes to be applied.
     39 * @access private
     40 *
     41 * @param  WP_Block_Type $block_type       Block Type.
    3842 * @param  array         $block_attributes Block attributes.
    39  * @param  WP_Block_Type $block_type       Block Type.
    4043 *
    4144 * @return array Block CSS classes and inline styles.
    4245 */
    43 function wp_apply_generated_classname_support( $attributes, $block_attributes, $block_type ) {
     46function wp_apply_generated_classname_support( $block_type, $block_attributes ) {
    4447    $has_generated_classname_support = true;
     48    $attributes                      = array();
    4549    if ( property_exists( $block_type, 'supports' ) ) {
    4650        $has_generated_classname_support = wp_array_get( $block_type->supports, array( 'className' ), true );
     
    5054
    5155        if ( $block_classname ) {
    52             $attributes['css_classes'][] = $block_classname;
     56            $attributes['class'] = $block_classname;
    5357        }
    5458    }
     
    5660    return $attributes;
    5761}
     62
     63// Register the block support.
     64WP_Block_Supports::get_instance()->register(
     65    'generated-classname',
     66    array(
     67        'apply' => 'wp_apply_generated_classname_support',
     68    )
     69);
Note: See TracChangeset for help on using the changeset viewer.