You are here

public function UnpublishNow::doExecute in Scheduler 8

Same name and namespace in other branches
  1. 2.x scheduler_rules_integration/src/Plugin/RulesAction/UnpublishNow.php \Drupal\scheduler_rules_integration\Plugin\RulesAction\UnpublishNow::doExecute()

Set the node status to Unpublished.

This action should really be provided by Rules or by Core, but it is not yet done (as of Aug 2016). Scheduler users need this action so we provide it here. It could be removed later when Rules or Core includes it.

File

scheduler_rules_integration/src/Plugin/RulesAction/UnpublishNow.php, line 31

Class

UnpublishNow
Provides an 'Unpublish the node immediately' action.

Namespace

Drupal\scheduler_rules_integration\Plugin\RulesAction

Code

public function doExecute() {
  $node = $this
    ->getContextValue('node');
  $node
    ->setUnpublished();
}