Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from newfold-labs/fix/class-name-in-collect-met…
Browse files Browse the repository at this point in the history
…hod-for-cron-filter

Fix the bad class name used in cron filter
  • Loading branch information
circlecube authored Dec 12, 2022
2 parents 436965d + 7308b51 commit 207fa07
Showing 1 changed file with 33 additions and 22 deletions.
55 changes: 33 additions & 22 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use function NewfoldLabs\WP\ModuleLoader\register as registerModule;

/**
* Register the data module
* Register the newfold customer data module for bluehost
*/
if ( function_exists( 'add_action' ) ) {

Expand All @@ -18,34 +18,45 @@ function () {
array(
'name' => 'newfold-customer-bluehost',
'label' => __( 'Customer Bluehost', 'newfold-customer-bluehost' ),
'callback' => function ( Container $container ) {
new CustomerBluehost( $container );
},
'callback' => 'newfold_module_load_customer_bluehost',
'isActive' => true,
'isHidden' => true,
)
);

}
);
}

/**
* Initialize CustomerBluehost class instance and add required filters
*
* @param Container the module loader container
* @return void
*/
function newfold_module_load_customer_bluehost( Container $container ) {
new CustomerBluehost( $container );

// Add filter callback to add bluehost customer data to data module in cron event data
add_filter(
'newfold_wp_data_module_cron_data_filter',
function( $data ) {
// Filter the cron event data object with bluehost specific customer data
$data['customer'] = Customer\Bluehost::collect();
return $data;
}
);

// Add filter callback to add site_id to core data module data
add_filter(
'newfold_wp_data_module_core_data_filter',
function( $data ) {
$data['site_id'] = SiteMeta::get_id();
return $data;
}
);

if ( function_exists( 'add_filter' ) ) {
// Add filter for adding bluehost customer data to data module in cron event data
add_filter(
'newfold_wp_data_module_cron_data_filter',
function( $data ) {
// Filter the cron event data object with bluehost specific customer data
$data['customer'] = CustomerBluehost::collect();
return $data;
}
);

// Add filter to add site_id to core data module data
add_filter(
'newfold_wp_data_module_core_data_filter',
function( $data ) {
$data['site_id'] = SiteMeta::get_id();
return $data;
}
);
}

}

0 comments on commit 207fa07

Please sign in to comment.