public function SaveMedia::execute in Media Entity Actions 8
Same name and namespace in other branches
- 8.2 src/Plugin/Action/SaveMedia.php \Drupal\media_entity_actions\Plugin\Action\SaveMedia::execute()
Executes the plugin.
Overrides ExecutableInterface::execute
File
- src/
Plugin/ Action/ SaveMedia.php, line 23
Class
- SaveMedia
- Saves a media item.
Namespace
Drupal\media_entity_actions\Plugin\ActionCode
public function execute(MediaInterface $entity = NULL) {
if ($entity) {
// We need to change at least one value, otherwise the changed timestamp
// will not be updated.
$entity
->setChangedTime(0)
->save();
}
}