WordPress at a glance
function is not described

WP_Block_Supports::apply_block_supports() public WP 5.6.0

Generates an array of HTML attributes, such as classes, by applying to the given block all of the features that the block supports.

{} It's a method of the class: WP_Block_Supports{}

No Hooks.

Return

Array. Array of HTML attributes.

Usage

$WP_Block_Supports = new WP_Block_Supports();
$WP_Block_Supports->apply_block_supports();

Changelog

Since 5.6.0 Introduced.

Code of WP_Block_Supports::apply_block_supports() WP 5.7.2

<?php
public function apply_block_supports() {
	$block_attributes = self::$block_to_render['attrs'];
	$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 || empty( $block_type ) ) {
		return 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 ( empty( $output[ $attribute_name ] ) ) {
					$output[ $attribute_name ] = $attribute_value;
				} else {
					$output[ $attribute_name ] .= " $attribute_value";
				}
			}
		}
	}

	return $output;
}