public function UnpublishMedia::execute in Media entity 8
Same name and namespace in other branches
- 8.2 src/Plugin/Action/UnpublishMedia.php \Drupal\media_entity\Plugin\Action\UnpublishMedia::execute()
Executes the plugin.
Overrides ExecutableInterface::execute
File
- src/
Plugin/ Action/ UnpublishMedia.php, line 23
Class
- UnpublishMedia
- Unpublishes a media entity.
Namespace
Drupal\media_entity\Plugin\ActionCode
public function execute(Media $entity = NULL) {
$entity
->setPublished(FALSE)
->save();
}