From 954ec74caa60ccfdbec0ed381f95af88e8532850 Mon Sep 17 00:00:00 2001 From: arunshenoy99 Date: Mon, 6 Mar 2023 16:44:34 +0530 Subject: [PATCH] use brand from plugin container --- bootstrap.php | 7 +++++++ includes/Data/Data.php | 28 +++++++++++----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/bootstrap.php b/bootstrap.php index bdd6f1d3d..fce9c4bd4 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -33,6 +33,13 @@ function nfd_wp_module_onboarding_register() { if ( ! defined( 'NFD_ONBOARDING_BUILD_URL' && defined( 'NFD_ONBOARDING_VERSION' ) ) ) { define( 'NFD_ONBOARDING_BUILD_URL', $container->plugin()->url . '/vendor/newfold-labs/wp-module-onboarding/build/' . NFD_ONBOARDING_VERSION ); } + if ( ! defined( 'NFD_ONBOARDING_PLUGIN_BRAND' ) ) { + $brand = $container->plugin()->brand; + if ( empty( $brand ) ) { + $brand = 'newfold'; + } + define( 'NFD_ONBOARDING_PLUGIN_BRAND', sanitize_title_with_dashes( str_replace( '_', '-', $brand ) ) ); + } // Instantiate Onboarding Module Application new Application( $container ); }, diff --git a/includes/Data/Data.php b/includes/Data/Data.php index 8a29b2143..1a131b516 100644 --- a/includes/Data/Data.php +++ b/includes/Data/Data.php @@ -36,17 +36,11 @@ public static function runtime() { * @return array */ public static function current_brand() { - - $brand = \get_option( Options::get_option_name( 'brand', false ), 'newfold' ); - // This case arises when the option mm_brand exists but has an empty string as it's value. - if ( empty( $brand ) ) { - $brand = 'newfold'; - } - $brand = \apply_filters( 'nfd_module_onboarding_brand', sanitize_title_with_dashes( str_replace( '_', '-', $brand ) ) ); - $brands = Brands::get_brands(); - return array_key_exists( $brand, $brands ) ? $brands[ $brand ] : array( 'brand' => $brand ); + return array_key_exists( NFD_ONBOARDING_PLUGIN_BRAND, $brands ) ? + $brands[ NFD_ONBOARDING_PLUGIN_BRAND ] : + array( 'brand' => NFD_ONBOARDING_PLUGIN_BRAND ); } @@ -60,11 +54,11 @@ public static function current_plan() { $current_flow = Flows::get_flow_from_customer_data( $customer_data ); if ( false !== $current_flow ) { - return array( - 'flow' => $current_flow, - 'subtype' => $customer_data['plan_subtype'], - 'type' => $customer_data['plan_type'], - ); + return array( + 'flow' => $current_flow, + 'subtype' => $customer_data['plan_subtype'], + 'type' => $customer_data['plan_type'], + ); } $current_flow = Flows::get_flow_from_params(); @@ -128,9 +122,9 @@ public static function current_flow() { */ public static function customer_data() { if ( class_exists( 'NewfoldLabs\WP\Module\CustomerBluehost\CustomerBluehost' ) ) { - return CustomerBluehost::collect(); + return CustomerBluehost::collect(); } - return array(); + return array(); } -} // END \NewfoldLabs\WP\Module\Onboarding\Data() +}