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-styles.php

    r61084 r61550  
    494494                $this->print_html     = '';
    495495        }
     496
     497        /**
     498         * Gets a style-specific dependency warning message.
     499         *
     500         * @since 6.9.1
     501         *
     502         * @param string   $handle                     Style handle with missing dependencies.
     503         * @param string[] $missing_dependency_handles Missing dependency handles.
     504         * @return string Formatted, localized warning message.
     505         */
     506        protected function get_dependency_warning_message( $handle, $missing_dependency_handles ) {
     507                return sprintf(
     508                        /* translators: 1: Style handle, 2: List of missing dependency handles. */
     509                        __( 'The style with the handle "%1$s" was enqueued with dependencies that are not registered: %2$s.' ),
     510                        $handle,
     511                        implode( wp_get_list_item_separator(), $missing_dependency_handles )
     512                );
     513        }
    496514}
Note: See TracChangeset for help on using the changeset viewer.