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
$attr_names = $p->get_attribute_names_with_prefix( '' ) ?? array();
foreach ( $attr_names as $name ) {
$element_attrs[ $name ] = $p->get_attribute( $name );
}
// Assign the current element right before running its directive processors.
$this->current_element = array(
'attributes' => $element_attrs,
);
foreach ( $modes as $mode => $should_run ) {
if ( ! $should_run ) {
continue;
}
/*
* Sorts the attributes by the order of the `directives_processor` array
* and checks what directives are present in this element.
*/
$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 ) );
}
Changelog
Version | Description |
---|---|
6.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.