WP_Interactivity_API::data_wp_interactive_processor( WP_Interactivity_API_Directives_Processor $p, string $mode, array $context_stack, array $namespace_stack )

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Processes the data-wp-interactive directive.

Description

It adds the default store namespace defined in the directive value to the stack so that it’s available for the nested interactivity elements.

Parameters

$pWP_Interactivity_API_Directives_Processorrequired
The directives processor instance.
$modestringrequired
Whether the processing is entering or exiting the tag.
$context_stackarrayrequired
The reference to the context stack.
$namespace_stackarrayrequired
The reference to the store namespace stack.

Source

		$existing_directives_prefixes = array_intersect(
			'enter' === $mode ? $directive_processor_prefixes : $directive_processor_prefixes_reversed,
			$directives_prefixes
		);
		foreach ( $existing_directives_prefixes as $directive_prefix ) {
			$func = is_array( self::$directive_processors[ $directive_prefix ] )
				? self::$directive_processors[ $directive_prefix ]
				: array( $this, self::$directive_processors[ $directive_prefix ] );

			call_user_func_array( $func, array( $p, $mode, &$tag_stack ) );
		}
	}

	// Clear the current element.
	$this->current_element = null;
}

if ( $unbalanced ) {
	// Reset the namespace and context stacks to their previous values.
	array_splice( $this->namespace_stack, $namespace_stack_size );
	array_splice( $this->context_stack, $context_stack_size );
}

/*
 * It returns null if the HTML is unbalanced because unbalanced HTML is
 * not safe to process. In that case, the Interactivity API runtime will
 * update the HTML on the client side during the hydration. It will also
 * display a notice to the developer to inform them about the issue.
 */
if ( $unbalanced || 0 < count( $tag_stack ) ) {
	$tag_errored = 0 < count( $tag_stack ) ? end( $tag_stack )[0] : $tag_name;

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.