returns true/false; call not earlier than 'init' action with the priority of 1
$module_active = jet_engine()->modules->is_module_active( 'data-stores' );
returns instance of \Jet_Engine\Modules\Data_Stores\Stores\Factory
To be found here \jet-engine\includes\modules\data-stores\inc\stores\factory.php
$store_factory = \Jet_Engine\Modules\Data_Stores\Module::instance()->stores->get_store( $store_slug );
returns instance of a class, which is an extension of \Jet_Engine\Modules\Data_Stores\Stores\Base_Store
Store types to be found here \jet-engine\includes\modules\data-stores\inc\stores
$store_type = $store_factory->get_type();
$in_store = $store_factory->in_store( $item_id );
for countable stores
$in_store = $store_factory->get_post_count( $item_id );
$items = $store_type->get( $store_slug );
$store_type->add_to_store( $store_slug, $item_id );
$store_type->remove( $store_slug, $item_id );
Run on AJAX add to store / remove from store (when the user clicks Dynamic Link / Data Store Button)
add_action( 'jet-engine/data-stores/before-add-to-store', function( $item_id, $store_slug, $store_factory ) {
//do something
}, 0, 3 );
add_action( 'jet-engine/data-stores/after-add-to-store', function( $item_id, $store_slug, $store_factory ) {
//do something
}, 0, 3 );
add_action( 'jet-engine/data-stores/before-remove-from-store', function( $item_id, $store_slug, $store_factory ) {
//do something
}, 0, 3 );
add_action( 'jet-engine/data-stores/after-remove-from-store', function( $item_id, $store_slug, $store_factory ) {
//do something
}, 0, 3 );
Meant to be used for a custom countable store
add_action( 'jet-engine/data-stores/post-count-increased', function( $item_id, $count, $store_factory ) {
//store new count increased by 1
} );
add_action( 'jet-engine/data-stores/post-count-decreased', function( $item_id, $count, $store_factory ) {
//store new count decreased by 1
} );
add_filter( 'jet-engine/data-stores/pre-get-post-count', function( $count, $item_id, $store_factory ) {
//$count = false
//get item count in a custom way and store it to $count
return $count;
} );
Help full Docs