You are here

public function PublishAction::execute in Drupal 10

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

File

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

Class

PublishAction
Publishes an entity.

Namespace

Drupal\Core\Action\Plugin\Action

Code

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