Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Brand from the Plugin container #191

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
},
Expand Down
28 changes: 11 additions & 17 deletions includes/Data/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}


Expand All @@ -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();
Expand Down Expand Up @@ -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()
}