Skip to content

Commit

Permalink
Add condition to enable gallery carousel and lightbox based on global…
Browse files Browse the repository at this point in the history
… settings

These changes add block attributes as ampCarousel and ampLightbox to true/false if the block is core/gallery and based on settings.
  • Loading branch information
thelovekesh committed Jul 10, 2022
1 parent 4da186f commit 288239e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions includes/embeds/class-amp-core-block-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ public function filter_rendered_block( $block_content, $block ) {
return $block_content; // @codeCoverageIgnore
}

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'];
}

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

0 comments on commit 288239e

Please sign in to comment.