Make WordPress Core


Ignore:
Timestamp:
11/30/2025 12:54:26 AM (8 weeks ago)
Author:
westonruter
Message:

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

Developed in https://github.com/WordPress/wordpress-develop/pull/10545

Follow-up to [60999].

Props deepakprajapati, westonruter.
See #63486.
Fixes #64229.

File:
1 edited

Legend:

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

    r61084 r61323  
    494494        $this->print_html     = '';
    495495    }
     496
     497    /**
     498     * Gets a style-specific dependency warning message.
     499     *
     500     * @since 7.0.0
     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: Comma-separated 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( ', ', $missing_dependency_handles )
     512        );
     513    }
    496514}
Note: See TracChangeset for help on using the changeset viewer.