Created
September 27, 2024 15:56
-
-
Save ahebrank/de042ce7515ba832a1879ff6ec7fda3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/EventSubscriber/StageFileProxySubscriber.php b/src/EventSubscriber/StageFileProxySubscriber.php | |
index b3b51bd..0199350 100644 | |
--- a/src/EventSubscriber/StageFileProxySubscriber.php | |
+++ b/src/EventSubscriber/StageFileProxySubscriber.php | |
@@ -55,6 +55,10 @@ class StageFileProxySubscriber implements EventSubscriberInterface { | |
public function checkFileOrigin(RequestEvent $event) { | |
$config = $this->configFactory->get('stage_file_proxy.settings'); | |
+ if ($config->get('disabled')) { | |
+ return; | |
+ } | |
+ | |
// Get the origin server. | |
$server = $config->get('origin'); | |
diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php | |
index da9c91e..f9fc4d3 100644 | |
--- a/src/Form/SettingsForm.php | |
+++ b/src/Form/SettingsForm.php | |
@@ -53,6 +53,14 @@ class SettingsForm extends ConfigFormBase { | |
public function buildForm(array $form, FormStateInterface $form_state, $field_type = NULL) { | |
$config = $this->config('stage_file_proxy.settings'); | |
+ $form['disabled'] = [ | |
+ '#type' => 'checkbox', | |
+ '#title' => $this->t('Disable proxy'), | |
+ '#default_value' => $config->get('disabled'), | |
+ '#description' => $this->t("Disable proxy. Use \$config['stage_file_proxy.settings']['disabled'] = 1; in settings.php to override module config and force disabling."), | |
+ '#required' => FALSE, | |
+ ]; | |
+ | |
$form['origin'] = [ | |
'#type' => 'textfield', | |
'#title' => $this->t('Origin website'), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment