You are here

public function ModerationOptOutUnpublishNode::execute in Workbench Moderation 8.2

Same name and namespace in other branches
  1. 8 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 42

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)) {
    drupal_set_message($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);
}