Make WordPress Core

Changeset 57563


Ignore:
Timestamp:
02/08/2024 09:11:43 AM (10 months ago)
Author:
gziolo
Message:

Interactivity API: Integrate Server Directive Processing

The Interactivity API enables WordPress developers to create dynamic and interactive web experiences with ease using a set of special HTML attributes called directives. Please refer to the [Interactivity API proposal](https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/) for further details.

It syncs the changes from the Gutenberg plugin: https://github.com/WordPress/gutenberg/pull/58066.

Fixes #60356.
Props luisherranz, jonsurrell, swissspidy, westonruter, gziolo.

Location:
trunk
Files:
16 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/composer.json

    r57378 r57563  
    1111    },
    1212    "require": {
     13        "ext-json": "*",
    1314        "php": ">=7.0"
    1415    },
  • trunk/src/wp-includes/interactivity-api.php

    r57499 r57563  
    1 <?php
    2 /**
    3  * Interactivity API: Functions and hooks
    4  *
    5  * @package WordPress
    6  * @subpackage Interactivity API
    7  */
    8 
    9 /**
    10  * Registers the interactivity modules.
    11  */
    12 function wp_interactivity_register_script_modules() {
    13     wp_register_script_module(
    14         '@wordpress/interactivity',
    15         includes_url( '/js/dist/interactivity.min.js' ),
    16         array()
    17     );
    18 
    19     wp_register_script_module(
    20         '@wordpress/interactivity-router',
    21         includes_url( '/js/dist/interactivity-router.min.js' ),
    22         array( '@wordpress/interactivity' )
    23     );
    24 }
    25 
    26 add_action( 'init', 'wp_interactivity_register_script_modules' );
  • trunk/src/wp-settings.php

    r57562 r57563  
    386386require ABSPATH . WPINC . '/class-wp-script-modules.php';
    387387require ABSPATH . WPINC . '/script-modules.php';
    388 require ABSPATH . WPINC . '/interactivity-api.php';
     388require ABSPATH . WPINC . '/interactivity-api/class-wp-interactivity-api.php';
     389require ABSPATH . WPINC . '/interactivity-api/class-wp-interactivity-api-directives-processor.php';
     390require ABSPATH . WPINC . '/interactivity-api/interactivity-api.php';
    389391
    390392wp_script_modules()->add_hooks();
     393wp_interactivity()->add_hooks();
    391394
    392395$GLOBALS['wp_embed'] = new WP_Embed();
Note: See TracChangeset for help on using the changeset viewer.