You are here

public function PublishMedia::execute in Media entity 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Action/PublishMedia.php \Drupal\media_entity\Plugin\Action\PublishMedia::execute()

Executes the plugin.

Overrides ExecutableInterface::execute

File

src/Plugin/Action/PublishMedia.php, line 23

Class

PublishMedia
Publishes a media entity.

Namespace

Drupal\media_entity\Plugin\Action

Code

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