Make WordPress Core

Changeset 57677


Ignore:
Timestamp:
02/21/2024 11:18:34 AM (2 months ago)
Author:
gziolo
Message:

Editor: Add fallback for block version when registering block script module

It aligns implementation with how regular scripts are handled.

Follow-up [57437].
See #60233.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks.php

    r57675 r57677  
    173173    $module_asset        = ! empty( $module_asset_path ) ? require $module_asset_path : array();
    174174    $module_dependencies = isset( $module_asset['dependencies'] ) ? $module_asset['dependencies'] : array();
     175    $block_version       = isset( $metadata['version'] ) ? $metadata['version'] : false;
     176    $module_version      = isset( $module_asset['version'] ) ? $module_asset['version'] : $block_version;
    175177
    176178    wp_register_script_module(
     
    178180        $module_uri,
    179181        $module_dependencies,
    180         isset( $module_asset['version'] ) ? $module_asset['version'] : false
     182        $module_version
    181183    );
    182184
     
    226228
    227229    // Asset file for blocks is optional. See https://core.trac.wordpress.org/ticket/60460.
    228     $script_asset = ! empty( $script_asset_path ) ? require $script_asset_path : array();
     230    $script_asset  = ! empty( $script_asset_path ) ? require $script_asset_path : array();
    229231    $script_handle = isset( $script_asset['handle'] ) ?
    230232        $script_asset['handle'] :
Note: See TracChangeset for help on using the changeset viewer.