You are here

public function ModerationOptOutUnpublishNode::execute in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Action/ModerationOptOutUnpublishNode.php \Drupal\workbench_moderation\Plugin\Action\ModerationOptOutUnpublishNode::execute()

Executes the plugin.

Overrides UnpublishAction::execute

File

src/Plugin/Action/ModerationOptOutUnpublishNode.php, line 49

Class

ModerationOptOutUnpublishNode
Alternate action plugin that knows to opt-out of modifying moderated entites.

Namespace

Drupal\workbench_moderation\Plugin\Action

Code

public function execute($entity = NULL) {
  if ($entity && $this->moderationInfo
    ->isModeratableEntity($entity)) {
    $this
      ->messenger()
      ->addMessage($this
      ->t('One or more entities were skipped as they are under moderation and may not be directly published or unpublished.'));
    return;
  }
  parent::execute($entity);
}