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

Fix the bad class name used in cron filter #2

Merged
merged 1 commit into from
Dec 12, 2022
Merged
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
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;
}
);
}

}