Skip to content

Commit

Permalink
rorganise code
Browse files Browse the repository at this point in the history
  • Loading branch information
Takshil-Kunadia committed Nov 14, 2024
1 parent a27f07f commit 52fc462
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion includes/class-amp-theme-support.php
Original file line number Diff line number Diff line change
Expand Up @@ -1378,8 +1378,12 @@ protected static function is_exclusively_dependent( WP_Dependencies $dependencie
* @return string Tag.
*/
public static function filter_admin_bar_style_loader_tag( $tag, $handle ) {
// Get Admin bar styles.
$admin_bar_dep = wp_styles()->query( 'admin-bar' );

// Check if the handle is a dependency of the admin-bar. If so, add the data-ampdevmode attribute.
if (
! 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 ) ?
$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' )
) {
Expand Down

0 comments on commit 52fc462

Please sign in to comment.