Fix check for empty dependencies on admin bar style loader tag filter#7920
Open
Takshil-Kunadia wants to merge 4 commits intoampproject:developfrom
Open
Fix check for empty dependencies on admin bar style loader tag filter#7920Takshil-Kunadia wants to merge 4 commits intoampproject:developfrom
Takshil-Kunadia wants to merge 4 commits intoampproject:developfrom
Conversation
westonruter
reviewed
Nov 13, 2024
Comment on lines
1381
to
1384
| if ( | ||
| is_array( wp_styles()->registered['admin-bar']->deps ) && in_array( $handle, wp_styles()->registered['admin-bar']->deps, true ) ? | ||
| ! empty( wp_styles()->registered['admin-bar']->deps ) && is_array( wp_styles()->registered['admin-bar']->deps ) && in_array( $handle, wp_styles()->registered['admin-bar']->deps, true ) ? | ||
| self::is_exclusively_dependent( wp_styles(), $handle, 'admin-bar' ) : | ||
| self::has_dependency( wp_styles(), $handle, 'admin-bar' ) |
Member
There was a problem hiding this comment.
Alternatively:
$admin_bar_dep = wp_styles()->query( 'admin-bar', 'registered' );
if (
$admin_bar_dep && in_array( $handle, $admin_bar_dep->deps, true ) ?
self::is_exclusively_dependent( wp_styles(), $handle, 'admin-bar' ) :
self::has_dependency( wp_styles(), $handle, 'admin-bar' )
Contributor
Author
There was a problem hiding this comment.
yes, much better.
Contributor
Author
There was a problem hiding this comment.
Also we don't need to pass status param in query() as the default value is 'registered'.
Contributor
Author
|
Should we add the same checks here as well? amp-wp/includes/class-amp-theme-support.php Lines 1404 to 1414 in 79b1b7a amp-wp/includes/class-amp-theme-support.php Lines 1426 to 1435 in 79b1b7a |
Member
|
@Takshil-Kunadia sure, sounds good! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #7766
depsis a non-nullable property of WP_Styles.Checklist