diff --git a/core/modules/system/src/Plugin/Condition/RequestPath.php b/core/modules/system/src/Plugin/Condition/RequestPath.php index 9b4bd474d1..2d3c8f0fb2 100644 --- a/core/modules/system/src/Plugin/Condition/RequestPath.php +++ b/core/modules/system/src/Plugin/Condition/RequestPath.php @@ -118,7 +118,10 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { $paths = array_map('trim', explode("\n", $form_state->getValue('pages'))); foreach ($paths as $path) { - if (empty($path) || $path === '' || str_starts_with($path, '/')) { + // Added extra condition to IF statement to allow for '!/' to be used as I can not think of any other way + // to allow for the use of the '!' character in the path overwire with custom modules. + // This is needed for contrubuted modules: 'https://www.drupal.org/project/block_exclude_pages' + if (empty($path) || $path === '' || str_starts_with($path, '/') || str_starts_with($path, '!/') ) { continue; } $form_state->setErrorByName('pages', $this->t("The path %path requires a leading forward slash when used with the Pages setting.", ['%path' => $path]));