You are here

public function Batch::processNode in Node Revisions Autoclean 8

File

src/Batch/Batch.php, line 9

Class

Batch

Namespace

Drupal\node_revisions_autoclean\Batch

Code

public function processNode($id, $nid, &$context) {
  $node = Node::load($nid);

  /* @var $revisionsManager \Drupal\node_revisions_autoclean\Services\RevisionsManager */
  $revisionsManager = \Drupal::service('node_revisions_autoclean.revisions_manager');
  $revisions = $revisionsManager
    ->revisionsToDelete($node);
  $revisionsManager
    ->deleteRevisions($revisions);
  $context['results'][] = $id;
  $context['message'] = t('Running Batch node revisions autoclean "@id" on node @nid', [
    '@id' => $id,
    '@nid' => $nid,
  ]);
}