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
$p
WP_Interactivity_API_Directives_Processorrequired- The directives processor instance.
$mode
stringrequired- Whether the processing is entering or exiting the tag.
$context_stack
arrayrequired- The reference to the context stack.
$namespace_stack
arrayrequired- 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
Version | Description |
---|---|
6.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.