public function PublishMedia::execute in Media Entity Actions 8
Same name and namespace in other branches
- 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\ActionCode
public function execute(MediaInterface $entity = NULL) {
if ($entity) {
$entity
->setPublished()
->save();
}
}