Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update logic to avoid unnecessary calls
  • Loading branch information
SantosGuillamot committed Oct 3, 2023
commit 629f48e40f989c2292b5c223dfdd1702846ae50c
11 changes: 11 additions & 0 deletions packages/block-library/src/image/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,17 @@ function block_core_image_render_lightbox( $block_content, $block ) {
// If the current theme does NOT have a `theme.json`, or the colors are not defined,
// we need to set the background color & close button color to some default values
// because we can't get them from the Global Styles.
$background_color = '#fff';
$close_button_color = '#000';
if ( wp_theme_has_theme_json() ) {
$global_styles_color = wp_get_global_styles( array( 'color' ) );
if ( ! empty( $global_styles_color['background'] ) ) {
$background_color = esc_attr( $global_styles_color['background'] );
}
if ( ! empty( $global_styles_color['text'] ) ) {
$close_button_color = esc_attr( $global_styles_color['text'] );
}
}
$global_styles_color = wp_get_global_styles( array( 'color' ) );
$has_background_color = ! empty( $global_styles_color['background'] );
$has_text_color = ! empty( $global_styles_color['text'] );
Expand Down