wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_apply_anchor_support › WordPress Function

Da7.0.0
Deprecaton/a
› wp_apply_anchor_support ( $block_type, $block_attributes )
Accedi:
  • private
Parametri: (2)
  • (WP_Block_Type) $block_type Block Type.
    Richiesto: Sì
  • (array<string,mixed>) $block_attributes Block attributes.
    Richiesto: Sì
Ritorna:
  • (array<string,string>) Attributes with block anchor id.
Definito a:
Codex:

Add the anchor id to the output.



Sorgenti

function wp_apply_anchor_support( WP_Block_Type $block_type, array $block_attributes ): array {
	if ( empty( $block_attributes ) ) {
		return array();
	}

	if ( ! block_has_support( $block_type, array( 'anchor' ) ) ) {
		return array();
	}

	if ( ! isset( $block_attributes['anchor'] ) || ! is_string( $block_attributes['anchor'] ) || '' === $block_attributes['anchor'] ) {
		return array();
	}

	return array( 'id' => $block_attributes['anchor'] );
}