- Timestamp:
- 10/20/2020 01:33:02 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-supports/custom-classname.php
r49135 r49226 8 8 /** 9 9 * Registers the custom classname block attribute for block types that support it. 10 * 11 * @access private 10 12 * 11 13 * @param WP_Block_Type $block_type Block Type. … … 32 34 * Add the custom classnames to the output. 33 35 * 34 * @param array $attributes Comprehensive list of attributes to be applied. 36 * @access private 37 * 38 * @param WP_Block_Type $block_type Block Type. 35 39 * @param array $block_attributes Block attributes. 36 * @param WP_Block_Type $block_type Block Type.37 40 * 38 41 * @return array Block CSS classes and inline styles. 39 42 */ 40 function wp_apply_custom_classname_support( $ attributes, $block_attributes, $block_type) {43 function wp_apply_custom_classname_support( $block_type, $block_attributes ) { 41 44 $has_custom_classname_support = true; 45 $attributes = array(); 42 46 if ( property_exists( $block_type, 'supports' ) ) { 43 47 $has_custom_classname_support = wp_array_get( $block_type->supports, array( 'customClassName' ), true ); … … 47 51 48 52 if ( $has_custom_classnames ) { 49 $attributes['c ss_classes'][] = $block_attributes['className'];53 $attributes['class'] = $block_attributes['className']; 50 54 } 51 55 } … … 53 57 return $attributes; 54 58 } 59 60 // Register the block support. 61 WP_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.