diff --git a/config/install/media_entity_download.settings.yml b/config/install/media_entity_download.settings.yml index 8a0f0ca..f64f15b 100644 --- a/config/install/media_entity_download.settings.yml +++ b/config/install/media_entity_download.settings.yml @@ -1 +1 @@ -external_file_storage: FALSE +redirect_download: FALSE diff --git a/src/Controller/DownloadController.php b/src/Controller/DownloadController.php index ea98b12..a21f423 100644 --- a/src/Controller/DownloadController.php +++ b/src/Controller/DownloadController.php @@ -111,9 +111,9 @@ class DownloadController extends ControllerBase { $uri = $file->getFileUri(); $filename = $file->getFilename(); - $external = $this->config('media_entity_download.settings')->get('external_file_storage'); + $redirect = $this->config('media_entity_download.settings')->get('redirect_download'); - if ($external) { + if ($redirect) { $url = file_create_url($uri); $response = new TrustedRedirectResponse($url); } diff --git a/src/Form/MediaEntityDownloadConfig.php b/src/Form/MediaEntityDownloadConfig.php index 3e90ea8..ba54bae 100644 --- a/src/Form/MediaEntityDownloadConfig.php +++ b/src/Form/MediaEntityDownloadConfig.php @@ -31,11 +31,11 @@ class MediaEntityDownloadConfig extends ConfigFormBase { */ public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->config('media_entity_download.settings'); - $form['external_file_storage'] = [ + $form['redirect_download'] = [ '#type' => 'checkbox', - '#title' => $this->t('External File Storage'), - '#description' => $this->t('To enable handling of external files with media entity download, check this box.'), - '#default_value' => $config->get('external_file_storage'), + '#title' => $this->t('Redirect Download Requests'), + '#description' => $this->t('Redirect to file URI, instead of sending file itself, when responding to download requests handled by Media Entity Download.'), + '#default_value' => $config->get('redirect_download'), ]; return parent::buildForm($form, $form_state); } @@ -47,7 +47,7 @@ class MediaEntityDownloadConfig extends ConfigFormBase { parent::submitForm($form, $form_state); $this->config('media_entity_download.settings') - ->set('external_file_storage', $form_state->getValue('external_file_storage')) + ->set('redirect_download', $form_state->getValue('redirect_download')) ->save(); }