function business_rules_cron in Business Rules 8
Same name and namespace in other branches
- 2.x business_rules.module \business_rules_cron()
Implements hook_cron().
File
- ./
business_rules.module, line 459 - Business Rules module.
Code
function business_rules_cron() {
if (Drupal::hasContainer()) {
// Dispatch the cron runs business rules items.
$reacts_on_definition = \Drupal::getContainer()
->get('plugin.manager.business_rules.reacts_on')
->getDefinition('cron_runs');
$loop_control = time();
$dummy = new stdClass();
$event = new BusinessRulesEvent($dummy, [
'entity_type_id' => '',
'bundle' => NULL,
'entity' => NULL,
'entity_unchanged' => NULL,
'reacts_on' => $reacts_on_definition,
'loop_control' => $loop_control,
]);
$event_dispatcher = \Drupal::service('event_dispatcher');
$event_dispatcher
->dispatch($reacts_on_definition['eventName'], $event);
// Dispatch the scheduled items.
Schedule::executeSchedule($event);
}
}