- Timestamp:
- 10/20/2020 01:33:02 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-supports/generated-classname.php
r49135 r49226 8 8 /** 9 9 * Get the generated classname from a given block name. 10 * 11 * @access private 10 12 * 11 13 * @param string $block_name Block Name. … … 35 37 * Add the generated classnames to the output. 36 38 * 37 * @param array $attributes Comprehensive list of attributes to be applied. 39 * @access private 40 * 41 * @param WP_Block_Type $block_type Block Type. 38 42 * @param array $block_attributes Block attributes. 39 * @param WP_Block_Type $block_type Block Type.40 43 * 41 44 * @return array Block CSS classes and inline styles. 42 45 */ 43 function wp_apply_generated_classname_support( $ attributes, $block_attributes, $block_type) {46 function wp_apply_generated_classname_support( $block_type, $block_attributes ) { 44 47 $has_generated_classname_support = true; 48 $attributes = array(); 45 49 if ( property_exists( $block_type, 'supports' ) ) { 46 50 $has_generated_classname_support = wp_array_get( $block_type->supports, array( 'className' ), true ); … … 50 54 51 55 if ( $block_classname ) { 52 $attributes['c ss_classes'][] = $block_classname;56 $attributes['class'] = $block_classname; 53 57 } 54 58 } … … 56 60 return $attributes; 57 61 } 62 63 // Register the block support. 64 WP_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.