-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix check for empty dependencies on admin bar style loader tag filter #7920
base: develop
Are you sure you want to change the base?
Fix check for empty dependencies on admin bar style loader tag filter #7920
Conversation
includes/class-amp-theme-support.php
Outdated
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' ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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' )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, much better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we don't need to pass status param in query()
as the default value is 'registered'.
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
|
@Takshil-Kunadia sure, sounds good! |
Summary
Fixes #7766
deps
is a non-nullable property of WP_Styles.Checklist