Skip to content

Commit 67983f4

Browse files
committed
Update consition to add block attribute only if it's enabled in settings
1 parent e0a56bc commit 67983f4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

includes/embeds/class-amp-core-block-handler.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,15 @@ public function filter_rendered_block( $block_content, $block ) {
9191
}
9292

9393
if ( 'core/gallery' === $block['blockName'] ) {
94-
$amp_options = AMP_Options_Manager::get_options();
95-
$block['attrs']['ampCarousel'] = (bool) $amp_options['gallery_carousel'];
96-
$block['attrs']['ampLightbox'] = (bool) $amp_options['gallery_lightbox'];
94+
$amp_options = AMP_Options_Manager::get_options();
95+
96+
if ( $amp_options['gallery_carousel'] ) {
97+
$block['attrs']['ampCarousel'] = true;
98+
}
99+
100+
if ( $amp_options['gallery_lightbox'] ) {
101+
$block['attrs']['ampLightbox'] = true;
102+
}
97103
}
98104

99105
if ( isset( $block['attrs'] ) && 'core/shortcode' !== $block['blockName'] ) {

0 commit comments

Comments
 (0)