function node_revisions_autoclean_node_update in Node Revisions Autoclean 8
Implements hook_ENTITY_TYPE_update().
File
- ./
node_revisions_autoclean.module, line 32 - Contains node_revisions_autoclean.module.
Code
function node_revisions_autoclean_node_update(EntityInterface $entity) {
$config = \Drupal::config('node_revisions_autoclean.settings');
if ($config
->get('enable_on_node_update')) {
/* @var $revisionsManager \Drupal\node_revisions_autoclean\Services\RevisionsManager */
$revisionsManager = \Drupal::service('node_revisions_autoclean.revisions_manager');
$revisions = $revisionsManager
->revisionsToDelete($entity);
$revisionsManager
->deleteRevisions($revisions);
}
if ($config
->get('enable_on_cron')) {
$revisionsManager = \Drupal::service('node_revisions_autoclean.revisions_manager');
$revisionsManager
->queueNodeForCronJob($entity);
}
}