Make WordPress Core


Ignore:
Timestamp:
01/28/2026 09:28:06 PM (6 months ago)
Author:
jorbin
Message:

Script Loader: Emit notices when enqueueing a script, style, or script module with missing dependencies.

First Developed in https://github.com/WordPress/wordpress-develop/pull/10545. Backport developed in https://github.com/WordPress/wordpress-develop/pull/10789.

Follow-up to [60999].

Reviewed by jorbin, wildworks.
Merges [61323], [61357], and [61542].

Props deepakprajapati, westonruter, mukeshpanchal27, jorbin, wildworks.
See #63486.
Fixes #64229.

Location:
branches/6.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.9

  • branches/6.9/src/wp-includes/class-wp-scripts.php

    r61506 r61550  
    11651165                $this->ext_handles    = '';
    11661166        }
     1167
     1168        /**
     1169         * Gets a script-specific dependency warning message.
     1170         *
     1171         * @since 6.9.1
     1172         *
     1173         * @param string   $handle                     Script handle with missing dependencies.
     1174         * @param string[] $missing_dependency_handles Missing dependency handles.
     1175         * @return string Formatted, localized warning message.
     1176         */
     1177        protected function get_dependency_warning_message( $handle, $missing_dependency_handles ) {
     1178                return sprintf(
     1179                        /* translators: 1: Script handle, 2: List of missing dependency handles. */
     1180                        __( 'The script with the handle "%1$s" was enqueued with dependencies that are not registered: %2$s.' ),
     1181                        $handle,
     1182                        implode( wp_get_list_item_separator(), $missing_dependency_handles )
     1183                );
     1184        }
    11671185}
Note: See TracChangeset for help on using the changeset viewer.