PluginProbe
Gutenberg / 16.6.0
Gutenberg v16.6.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
gutenberg / lib / experimental / interactivity-api / directives / wp-bind.php

wp-bind.php in Gutenberg 16.6.0, at lib/experimental/interactivity-api/directives/wp-bind.php

33 lines 835 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Process the wp-bind directive attribute.
4 *
5 * @package Gutenberg
6 * @subpackage Interactivity API
7 */
8
9 /**
10 * Process wp-bind directive attribute.
11 *
12 * @param WP_Directive_Processor $tags Tags.
13 * @param WP_Directive_Context $context Directive context.
14 */
15 function gutenberg_interactivity_process_wp_bind( $tags, $context ) {
16 if ( $tags->is_tag_closer() ) {
17 return;
18 }
19
20 $prefixed_attributes = $tags->get_attribute_names_with_prefix( 'data-wp-bind--' );
21
22 foreach ( $prefixed_attributes as $attr ) {
23 list( , $bound_attr ) = WP_Directive_Processor::parse_attribute_name( $attr );
24 if ( empty( $bound_attr ) ) {
25 continue;
26 }
27
28 $expr = $tags->get_attribute( $attr );
29 $value = gutenberg_interactivity_evaluate_reference( $expr, $context->get_context() );
30 $tags->set_attribute( $bound_attr, $value );
31 }
32 }
33