You are here

public function UnpublishAction::execute in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Action/Plugin/Action/UnpublishAction.php \Drupal\Core\Action\Plugin\Action\UnpublishAction::execute()
  2. 10 core/lib/Drupal/Core/Action/Plugin/Action/UnpublishAction.php \Drupal\Core\Action\Plugin\Action\UnpublishAction::execute()

Executes the plugin.

Overrides ExecutableInterface::execute

File

core/lib/Drupal/Core/Action/Plugin/Action/UnpublishAction.php, line 21

Class

UnpublishAction
Unpublishes an entity.

Namespace

Drupal\Core\Action\Plugin\Action

Code

public function execute($entity = NULL) {
  $entity
    ->setUnpublished()
    ->save();
}