PluginProbe
Gutenberg / 19.8.0
Gutenberg v19.8.0
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / lib / interactivity-api.php

interactivity-api.php in Gutenberg 19.8.0, at lib/interactivity-api.php

34 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Interactivity API functions specific for the Gutenberg editor plugin.
4 *
5 * @package gutenberg
6 */
7
8 /**
9 * Adds script data to the interactivity-router script module.
10 *
11 * This filter is registered conditionally anticipating a WordPress Core change to add the script module data.
12 * The filter runs on 'after_setup_theme' (when Core registers Interactivity and Script Modules hooks)
13 * to ensure that the conditional registration happens after Core and correctly determine whether
14 * the filter should be added.
15 *
16 * @see https://github.com/WordPress/wordpress-develop/pull/7304
17 */
18 function gutenberg_register_interactivity_script_module_data_hooks() {
19 if ( ! has_filter( 'script_module_data_@wordpress/interactivity-router', array( wp_interactivity(), 'filter_script_module_interactivity_router_data' ) ) ) {
20 add_filter(
21 'script_module_data_@wordpress/interactivity-router',
22 function ( $data ) {
23 if ( ! isset( $data['i18n'] ) ) {
24 $data['i18n'] = array();
25 }
26 $data['i18n']['loading'] = __( 'Loading page, please wait.', 'default' );
27 $data['i18n']['loaded'] = __( 'Page Loaded.', 'default' );
28 return $data;
29 }
30 );
31 }
32 }
33 add_action( 'after_setup_theme', 'gutenberg_register_interactivity_script_module_data_hooks', 20 );
34