wp/wp-includes/class-wp-block-supports.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
   102 		if ( ! $block_type || empty( $block_type ) ) {
   102 		if ( ! $block_type || empty( $block_type ) ) {
   103 			return array();
   103 			return array();
   104 		}
   104 		}
   105 
   105 
   106 		$block_attributes = array_key_exists( 'attrs', self::$block_to_render ) && is_array( self::$block_to_render['attrs'] )
   106 		$block_attributes = array_key_exists( 'attrs', self::$block_to_render ) && is_array( self::$block_to_render['attrs'] )
   107 			? self::$block_to_render['attrs']
   107 			? $block_type->prepare_attributes_for_render( self::$block_to_render['attrs'] )
   108 			: array();
   108 			: array();
   109 
   109 
   110 		$output = array();
   110 		$output = array();
   111 		foreach ( $this->block_supports as $block_support_config ) {
   111 		foreach ( $this->block_supports as $block_support_config ) {
   112 			if ( ! isset( $block_support_config['apply'] ) ) {
   112 			if ( ! isset( $block_support_config['apply'] ) ) {
   179 		return '';
   179 		return '';
   180 	}
   180 	}
   181 
   181 
   182 	// This is hardcoded on purpose.
   182 	// This is hardcoded on purpose.
   183 	// We only support a fixed list of attributes.
   183 	// We only support a fixed list of attributes.
   184 	$attributes_to_merge = array( 'style', 'class', 'id' );
   184 	$attributes_to_merge = array( 'style', 'class', 'id', 'aria-label' );
   185 	$attributes          = array();
   185 	$attributes          = array();
   186 	foreach ( $attributes_to_merge as $attribute_name ) {
   186 	foreach ( $attributes_to_merge as $attribute_name ) {
   187 		if ( empty( $new_attributes[ $attribute_name ] ) && empty( $extra_attributes[ $attribute_name ] ) ) {
   187 		if ( empty( $new_attributes[ $attribute_name ] ) && empty( $extra_attributes[ $attribute_name ] ) ) {
   188 			continue;
   188 			continue;
   189 		}
   189 		}