| 1 |
<?php |
| 2 |
/** |
| 3 |
* Process wp-text directive attribute. |
| 4 |
* |
| 5 |
* @package Gutenberg |
| 6 |
* @subpackage Interactivity API |
| 7 |
*/ |
| 8 |
|
| 9 |
/** |
| 10 |
* Process wp-text directive attribute. |
| 11 |
* |
| 12 |
* @param WP_Directive_Processor $tags Tags. |
| 13 |
* @param WP_Directive_Context $context Directive context. |
| 14 |
* @param string $ns Namespace. |
| 15 |
*/ |
| 16 |
function gutenberg_interactivity_process_wp_text( $tags, $context, $ns ) { |
| 17 |
if ( $tags->is_tag_closer() ) { |
| 18 |
return; |
| 19 |
} |
| 20 |
|
| 21 |
$value = $tags->get_attribute( 'data-wp-text' ); |
| 22 |
if ( null === $value ) { |
| 23 |
return; |
| 24 |
} |
| 25 |
|
| 26 |
$text = gutenberg_interactivity_evaluate_reference( $value, $ns, $context->get_context() ); |
| 27 |
$tags->set_inner_html( esc_html( $text ) ); |
| 28 |
} |
| 29 |
|