Skip to content

Commit

Permalink
Update consition to add block attribute only if it's enabled in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
thelovekesh committed Jul 10, 2022
1 parent 288239e commit 22c4181
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions includes/embeds/class-amp-core-block-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,15 @@ public function filter_rendered_block( $block_content, $block ) {
}

if ( 'core/gallery' === $block['blockName'] ) {
$amp_options = AMP_Options_Manager::get_options();
$block['attrs']['ampCarousel'] = (bool) $amp_options['gallery_carousel'];
$block['attrs']['ampLightbox'] = (bool) $amp_options['gallery_lightbox'];
$amp_options = AMP_Options_Manager::get_options();

if ( $amp_options['gallery_carousel'] ) {
$block['attrs']['ampCarousel'] = true;
}

if ( $amp_options['gallery_lightbox'] ) {
$block['attrs']['ampLightbox'] = true;
}
}

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

0 comments on commit 22c4181

Please sign in to comment.