wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_apply_aria_label_support › WordPress Function

Since6.8.0
Deprecatedn/a
wp_apply_aria_label_support ( $block_type, $block_attributes )
Access:
  • private
Parameters: (2)
  • (WP_Block_Type) $block_type Block Type.
    Required: Yes
  • (array) $block_attributes Block attributes.
    Required: Yes
Returns:
  • (array) Block aria-label.
Defined at:
Codex:

Add the aria-label to the output.



Source

function wp_apply_aria_label_support( $block_type, $block_attributes ) {
	if ( ! $block_attributes ) {
		return array();
	}

	$has_aria_label_support = block_has_support( $block_type, array( 'ariaLabel' ), false );
	if ( ! $has_aria_label_support ) {
		return array();
	}

	$has_aria_label = array_key_exists( 'ariaLabel', $block_attributes );
	if ( ! $has_aria_label ) {
		return array();
	}
	return array( 'aria-label' => $block_attributes['ariaLabel'] );
}