You are here

public function ModerationOptOutPublishNode::execute in Workbench Moderation 8

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

Executes the plugin.

Overrides PublishAction::execute

File

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

Class

ModerationOptOutPublishNode
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);
}