Skip to content

Commit

Permalink
Featured Content: Update loading from different environments loading (#…
Browse files Browse the repository at this point in the history
…38215)

* Moved the check for plugins.php to inside init in case setup method is called from outside.

* Add setup from jetpack-mu-wpcom

* Remove setup from the class so that it's only set when called explicitly

* Changelogs

* Changelogs

* Bug on the check
  • Loading branch information
darssen authored Jul 5, 2024
1 parent 6675a6d commit 709dd1d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Classic Theme Helper - Featured Content: Moved check for plugins page to init since setup is used now externally
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Automattic\Jetpack\Assets;
use WP_Customize_Manager;
use WP_Query;
if ( ! class_exists( __NAMESPACE__ . '\Featured_Content' ) && isset( $GLOBALS['pagenow'] ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
if ( ! class_exists( __NAMESPACE__ . '\Featured_Content' ) ) {

/**
* Featured Content.
Expand Down Expand Up @@ -88,6 +88,9 @@ public static function setup() {
*/
public static function init() {

if ( isset( $GLOBALS['pagenow'] ) && 'plugins.php' === $GLOBALS['pagenow'] ) {
return;
}
/**
* Array variable to store theme support.
*
Expand Down Expand Up @@ -757,6 +760,4 @@ public static function jetpack_update_featured_content_for_split_terms( $old_ter
}
}
}

Featured_Content::setup();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Jetpack Mu Wpcom: Added call for Featured Content
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public static function load_features() {

// Initializers, if needed.
\Marketplace_Products_Updater::init();
\Automattic\Jetpack\Classic_Theme_Helper\Featured_Content::setup();

// Only load the Calypsoify and Masterbar features on WoA sites.
if ( class_exists( '\Automattic\Jetpack\Status\Host' ) && ( new \Automattic\Jetpack\Status\Host() )->is_woa_site() ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: other

Featured Content: Don't call setup for wpcom platform since jetpack-mu-wpcom already takes care of that.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
* @package automattic/jetpack
*/
use Automattic\Jetpack\Status\Host;

if ( ! class_exists( 'Featured_Content' ) && isset( $GLOBALS['pagenow'] ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {

Expand Down Expand Up @@ -357,5 +358,7 @@ public static function jetpack_update_featured_content_for_split_terms( $old_ter
}
}

Automattic\Jetpack\Classic_Theme_Helper\Featured_Content::setup();
if ( ! ( new Host() )->is_wpcom_platform() ) {
Automattic\Jetpack\Classic_Theme_Helper\Featured_Content::setup();
}
}

0 comments on commit 709dd1d

Please sign in to comment.