public function TemporaryFilesController::makePermanent in Monitoring 8
Makes a file permanent.
Parameters
\Drupal\monitoring\SensorConfigInterface $monitoring_sensor_config: The sensor config.
\Drupal\file\FileInterface $file: The file entity.
Return value
\Symfony\Component\HttpFoundation\RedirectResponse
1 string reference to 'TemporaryFilesController::makePermanent'
File
- src/
Controller/ TemporaryFilesController.php, line 49
Class
Namespace
Drupal\monitoring\ControllerCode
public function makePermanent(SensorConfigInterface $monitoring_sensor_config, FileInterface $file) {
$file
->setPermanent();
$file
->save();
$this->sensorRunner
->resetCache([
$monitoring_sensor_config
->id(),
]);
$this
->messenger()
->addMessage(t('File @file is now permanent.', [
'@file' => $file
->getFilename(),
]), 'status');
$url = $monitoring_sensor_config
->toUrl('details-form');
return $this
->redirect($url
->getRouteName(), $url
->getRouteParameters());
}