wp-includes/interactivity-api/class-wp-interactivity-api.php:15Class used to process the Interactivity API on the server.
$directive_processorsarray<string,private static$state_dataarrayprivate$config_dataarrayprivate$derived_state_closuresarrayprivate$has_processed_router_regionboolprivatedata-wp-router-region directive has been found in the HTML and processed.$namespace_stackarray<string|false>|nullprivatedata-wp-interactive directives, in the order they are processed.$context_stackarray<array<mixed>>|nullprivatedata-wp-context directives, in the order they are processed.$current_elementarray{attributes:privatefinal class WP_Interactivity_API { /** * Holds the mapping of directive attribute names to their processor methods. * * @since 6.5.0 * @var array<string, string> * @phpstan-var array{ * 'data-wp-interactive': 'data_wp_interactive_processor', * 'data-wp-router-region': 'data_wp_router_region_processor', * 'data-wp-context': 'data_wp_context_processor', * 'data-wp-bind': 'data_wp_bind_processor', * 'data-wp-class': 'data_wp_class_processor', * 'data-wp-style': 'data_wp_style_processor', * 'data-wp-text': 'data_wp_text_processor', * 'data-wp-each': 'data_wp_each_processor', * } */ private static array $directive_processors = array( 'data-wp-interactive' => 'data_wp_interactive_processor', 'data-wp-router-region' => 'data_wp_router_region_processor', 'data-wp-context' => 'data_wp_context_processor', 'data-wp-bind' => 'data_wp_bind_processor', 'data-wp-class' => 'data_wp_class_processor', 'data-wp-style' => 'data_wp_style_processor', 'data-wp-text' => 'data_wp_text_processor', /* * `data-wp-each` needs to be processed in the last place because it moves * the cursor to the end of the processed items to prevent them to be * processed twice. */ 'data-wp-each' => 'data_wp_each_processor', ); /** * Holds the initial state of the different Interactivity API stores. * * This state is used during the server directive processing. Then, it is * serialized and sent to the client as part of the interactivity data to be * recovered during the hydration of the client interactivity stores. * * @since 6.5.0 * @var array */ private $state_data = array(); /** * Holds the configuration required by the different Interactivity API stores. * * This configuration is serialized and sent to the client as part of the * interactivity data and can be accessed by the client interactivity stores. * * @since 6.5.0 * @var array */ private $config_data = array(); /** * Keeps track of all derived state closures accessed during server-side rendering. * * This data is serialized and sent to the client as part of the interactivity * data, and is handled later in the client to support derived state props that * are lazily hydrated. * * @since 6.9.0 * @var array */ private $derived_state_closures = array(); /** * Flag that indicates whether the `data-wp-router-region` directive has * been found in the HTML and processed. * * The value is saved in a private property of the WP_Interactivity_API * instance instead of using a static variable inside the processor * function, which would hold the same value for all instances * independently of whether they have processed any * `data-wp-router-region` directive or not. * * @since 6.5.0 * @var boolIntroduced in 6.5.0. 5 changes between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
add_load_on_client_navigation_attribute_to_script_modules() added.verified against sourceadd_client_navigation_support_to_script_module() added.verified against sourceparse_directive_name() added.verified against sourceget_directive_entries() added.verified against sourceextract_prefix_and_suffix() removed.verified against sourcesrc/wp-includes/interactivity-api/class-wp-interactivity-api.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.