# gutenberg/17.5.0/lib/experimental/interactivity-api/directives/wp-bind.php

Gutenberg, version 17.5.0. 34 lines.

- Page: https://pluginprobe.com/plugins/gutenberg/17.5.0/code/lib/experimental/interactivity-api/directives/wp-bind.php
- Raw: https://pluginprobe.com/plugins/gutenberg/17.5.0/raw/lib/experimental/interactivity-api/directives/wp-bind.php
- Modified: 2024-01-17T12:56:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/gutenberg/17.5.0/code/lib/experimental/interactivity-api/directives/wp-bind.php#L10-L20`.

```php
<?php
/**
 * Process the wp-bind directive attribute.
 *
 * @package Gutenberg
 * @subpackage Interactivity API
 */

/**
 * Process wp-bind directive attribute.
 *
 * @param WP_Directive_Processor $tags Tags.
 * @param WP_Directive_Context   $context Directive context.
 * @param string                 $ns Namespace.
 */
function gutenberg_interactivity_process_wp_bind( $tags, $context, $ns ) {
	if ( $tags->is_tag_closer() ) {
		return;
	}

	$prefixed_attributes = $tags->get_attribute_names_with_prefix( 'data-wp-bind--' );

	foreach ( $prefixed_attributes as $attr ) {
		list( , $bound_attr ) = WP_Directive_Processor::parse_attribute_name( $attr );
		if ( empty( $bound_attr ) ) {
			continue;
		}

		$reference = $tags->get_attribute( $attr );
		$value     = gutenberg_interactivity_evaluate_reference( $reference, $ns, $context->get_context() );
		$tags->set_attribute( $bound_attr, $value );
	}
}

```
