You are here

public function PublishMedia::execute in Media Entity Actions 8

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

Executes the plugin.

Overrides ExecutableInterface::execute

File

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

Class

PublishMedia
Publishes a media item.

Namespace

Drupal\media_entity_actions\Plugin\Action

Code

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