function PublishAction::execute

Same name in other branches
  1. 9 core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php \Drupal\Core\Action\Plugin\Action\PublishAction::execute()
  2. 8.9.x core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php \Drupal\Core\Action\Plugin\Action\PublishAction::execute()
  3. 10 core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php \Drupal\Core\Action\Plugin\Action\PublishAction::execute()

Overrides ExecutableInterface::execute

File

core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php, line 23

Class

PublishAction
Publishes an entity.

Namespace

Drupal\Core\Action\Plugin\Action

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.