wp_apply_aria_label_support()
Add the aria-label to the output.
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Return
Array
. Block aria-label.
Usage
wp_apply_aria_label_support( $block_type, $block_attributes );
- $block_type(WP_Block_Type) (required)
- Block Type.
- $block_attributes(array) (required)
- Block attributes.
Changelog
Since 6.8.0 | Introduced. |
wp_apply_aria_label_support() wp apply aria label support code WP 6.8
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'] ); }