You are here

public function ModerationOptOutPublishNode::execute in Workbench Moderation 8.2

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

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