wp-includes/class-wp-block-supports.php:114Generates an array of HTML attributes, such as classes, by applying to the given block all of the features that the block supports.
string[] public function apply_block_supports() { if ( ! is_array( self::$block_to_render ) ) { return array(); } $block_type = WP_Block_Type_Registry::get_instance()->get_registered( self::$block_to_render['blockName'] ); // If no render_callback, assume styles have been previously handled. if ( ! $block_type ) { return array(); } $block_attributes = array_key_exists( 'attrs', self::$block_to_render ) && is_array( self::$block_to_render['attrs'] ) ? $block_type->prepare_attributes_for_render( self::$block_to_render['attrs'] ) : array(); $output = array(); foreach ( $this->block_supports as $block_support_config ) { if ( ! isset( $block_support_config['apply'] ) ) { continue; } $new_attributes = call_user_func( $block_support_config['apply'], $block_type, $block_attributes ); if ( ! empty( $new_attributes ) ) { foreach ( $new_attributes as $attribute_name => $attribute_value ) { if ( ! is_scalar( $attribute_value ) || is_bool( $attribute_value ) ) { continue; } $attribute_value = (string) $attribute_value; if ( ! array_key_exists( $attribute_name, $output ) || '' === $output[ $attribute_name ] ) { $output[ $attribute_name ] = $attribute_value; } else { $output[ $attribute_name ] .= " $attribute_value"; } } } } return $output; }Introduced in 5.6.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/class-wp-block-supports.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.