You are here

public function PublishNow::doExecute in Scheduler 2.x

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

Set the entity status to Published.

This action is provided by the Rules Module but only for node content, not Media. There is also a problem with recursion in the Rules action due to autoSaveContext(). Hence better for Scheduler to provide this action.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to be published.

File

scheduler_rules_integration/src/Plugin/RulesAction/PublishNow.php, line 27

Class

PublishNow
Provides a 'Publish immediately' action.

Namespace

Drupal\scheduler_rules_integration\Plugin\RulesAction

Code

public function doExecute(EntityInterface $entity) {
  $entity
    ->setPublished();
}