Skip to content

Commit

Permalink
Carousel / Lightbox: take wpcom simple shortcircuit into account (#36914
Browse files Browse the repository at this point in the history
)

Fixes Automattic/wp-calypso#89564

Follow-up to #36565

This is a second take on #36565; we need to ensure that when one disables the Carousel feature on their wpcom simple site, we do not remove Core's Lightbox feature.
  • Loading branch information
jeherve authored Apr 17, 2024
1 parent 2874c2e commit 6dd4d98
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Carousel: ensure that disabling the feature on WordPress.com Simple brings back Core's Lightbox back.
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ public function init() {
$this->single_image_gallery_enabled = ! $this->maybe_disable_jp_carousel_single_images();
$this->single_image_gallery_enabled_media_file = $this->maybe_enable_jp_carousel_single_images_media_file();

// Disable core lightbox when Carousel is enabled.
add_action( 'wp_theme_json_data_theme', array( $this, 'disable_core_lightbox' ) );

if ( is_admin() ) {
// Register the Carousel-related related settings.
add_action( 'admin_init', array( $this, 'register_settings' ), 5 );
Expand All @@ -99,6 +96,9 @@ public function init() {
add_action( 'wp_ajax_nopriv_get_attachment_comments', array( $this, 'get_attachment_comments' ) );
add_action( 'wp_ajax_post_attachment_comment', array( $this, 'post_attachment_comment' ) );
add_action( 'wp_ajax_nopriv_post_attachment_comment', array( $this, 'post_attachment_comment' ) );

// Disable core lightbox when Carousel is enabled.
add_action( 'wp_theme_json_data_theme', array( $this, 'disable_core_lightbox' ) );
} else {
if ( ! $this->in_jetpack ) {
if ( 0 === $this->test_1or0_option( get_option( 'carousel_enable_it' ), true ) ) {
Expand Down Expand Up @@ -128,6 +128,9 @@ public function init() {

// `is_amp_request()` can't be called until the 'wp' filter.
add_action( 'wp', array( $this, 'check_amp_support' ) );

// Disable core lightbox when Carousel is enabled.
add_action( 'wp_theme_json_data_theme', array( $this, 'disable_core_lightbox' ) );
}

if ( $this->in_jetpack ) {
Expand Down

0 comments on commit 6dd4d98

Please sign in to comment.