Search by

drupal / node_revision_delete_protection

Drupal-Infrastructure

Lets editors protect node revisions from the automatic clean-up of Node Revision Delete.

Package info

git.drupalcode.org/project/node_revision_delete_protection.git

Homepage

Issues

Type:drupal-module

pkg:composer/drupal/node_revision_delete_protection

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

1.0.0 2026-11-24 17:38 UTC

This package is auto-updated.

Last update: 2026-11-24 16:59:37 UTC


README

Lets editors protect node revisions from the automatic clean-up of Node Revision Delete.

Requirements

  • Drupal 10.3, 11 or 12.
  • Node Revision Delete 2.1 or later.

Usage

  1. Enable the module.
  2. Give the Protect revisions permission to the roles that may protect revisions. They also need to be able to view the revisions of the content.
  3. In the Node Revision Delete settings (/admin/config/content/node_revision_delete), enable the Protected revision plugin, next to the plugins that delete revisions (amount, created, drafts, ...).

On the Revisions tab of a node, each revision but the current one then has a Protect revision operation. A protected revision is marked as such, loses its Delete operation, and is never deleted by the clean-up. Release protection makes it a revision like the others again.

The plugin never deletes a revision by itself. Revisions that are not protected are deleted or kept as the other enabled plugins decide.

To protect a revision in code:

\Drupal::service(\Drupal\node_revision_delete_protection\RevisionProtectionManagerInterface::class)
  ->protect('node', $node->id(), $node->getRevisionId(), 'Approved version');

Development

Tests run on GitLab CI for each push and merge request: PHPUnit (kernel and functional tests), PHPCS, PHPStan and CSpell, against the current Drupal version, the previous and next minor versions, Drupal 10 and the next major version.

To run the tests locally, from a Drupal site that has the module:

vendor/bin/phpunit -c web/core web/modules/contrib/node_revision_delete_protection