function scheduler_rules_integration_entity_update in Scheduler 2.x
Implements hook_entity_update().
File
- scheduler_rules_integration/
scheduler_rules_integration.module, line 73 - Scheduler Rules Integration.
Code
function scheduler_rules_integration_entity_update(EntityInterface $entity) {
$scheduler_manager = \Drupal::service('scheduler.manager');
// If this entity type is is not supported by Scheduler then go further.
if (!$scheduler_manager
->getPlugin($entity
->getEntityTypeId())) {
return;
}
// Invoke Rules events to indicate that an existing entity has been scheduled.
if (!empty($entity->publish_on->value)) {
_scheduler_rules_integration_event($entity, 'EXISTING_FOR_PUBLISHING');
}
if (!empty($entity->unpublish_on->value)) {
_scheduler_rules_integration_event($entity, 'EXISTING_FOR_UNPUBLISHING');
}
}