WPDev.one
Core Class

WP_Interactivity_API

class WP_Interactivity_API // Constructor: function Object() { [native code] }

Class used to process the Interactivity API on the server.

Methods 27 methods

Method / Return Description
state()
array

Gets and/or sets the initial state of an Interactivity API store for a

Parameters: $store_namespace: ?string, $state: ?array
config()
array

Gets and/or sets the configuration of the Interactivity API for a given

Parameters: $store_namespace: string, $config: array
print_client_interactivity_data()
void

Prints the serialized client-side interactivity data.

filter_script_module_interactivity_router_data()
array

Set client-side interactivity-router data.

Parameters: $data: array
filter_script_module_interactivity_data()
array

Set client-side interactivity data.

Parameters: $data: array
get_context()
void

Returns the latest value on the context stack with the passed namespace.

Parameters: $store_namespace: ?string
get_element()
(array{attributes:

Returns an array representation of the current element being processed.

register_script_modules()
void

Registers the `@wordpress/interactivity` script modules.

add_hooks()
void

Adds the necessary hooks for the Interactivity API.

process_directives()
string

Processes the interactivity directives contained within the HTML content

Parameters: $html: string
_process_directives()
(string

Processes the interactivity directives contained within the HTML content

Parameters: $html: string
evaluate()
(mixed

Evaluates the reference path passed to a directive based on the current

Parameters: $directive_value: mixed
extract_prefix_and_suffix()
array

Extracts the directive attribute name to separate and return the directive

Parameters: $directive_name: string
extract_directive_value()
array

Parses and extracts the namespace and reference path from the given

Parameters: $directive_value: mixed, $default_namespace: mixed
kebab_to_camel_case()
string

Transforms a kebab-case string to camelCase.

Parameters: $str: string
data_wp_interactive_processor()
void

Processes the `data-wp-interactive` directive.

Parameters: $p: WP_Interactivity_API_Directives_Processor, $mode: string
data_wp_context_processor()
void

Processes the `data-wp-context` directive.

Parameters: $p: WP_Interactivity_API_Directives_Processor, $mode: string
data_wp_bind_processor()
void

Processes the `data-wp-bind` directive.

Parameters: $p: WP_Interactivity_API_Directives_Processor, $mode: string
data_wp_class_processor()
void

Processes the `data-wp-class` directive.

Parameters: $p: WP_Interactivity_API_Directives_Processor, $mode: string
data_wp_style_processor()
void

Processes the `data-wp-style` directive.

Parameters: $p: WP_Interactivity_API_Directives_Processor, $mode: string
merge_style_property()
string

Merges an individual style property in the `style` attribute of an HTML

Parameters: $style_attribute_value: string, $style_property_name: string, $style_property_value: mixed
data_wp_text_processor()
void

Processes the `data-wp-text` directive.

Parameters: $p: WP_Interactivity_API_Directives_Processor, $mode: string
get_router_animation_styles()
string

Returns the CSS styles for animating the top loading bar in the router.

print_router_loading_and_screen_reader_markup()
void

Deprecated.

print_router_markup()
void

Outputs markup for the @wordpress/interactivity-router script module.

data_wp_router_region_processor()
void

Processes the `data-wp-router-region` directive.

Parameters: $p: WP_Interactivity_API_Directives_Processor, $mode: string
data_wp_each_processor()
void

Processes the `data-wp-each` directive.

Parameters: $p: WP_Interactivity_API_Directives_Processor, $mode: string, $tag_stack: array

Properties

Property / Type Description
$directive_processors
mixed
public
No description available.
$state_data
mixed
public
No description available.
$config_data
mixed
public
No description available.
$has_processed_router_region
mixed
public
No description available.
$namespace_stack
mixed
public
No description available.
$context_stack
mixed
public
No description available.
$current_element
mixed
public
No description available.

Class Information

Since Version
6.5.0
Source File
wp-includes/interactivity-api/class-wp-interactivity-api.php
Advertisement