Last active
May 4, 2016 08:42
-
-
Save damiankloip/b77ed5746945cb47cfd6fed861a7cc6a 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/docroot/core/modules/views/src/Form/ViewsExposedForm.php b/docroot/core/modules/views/src/Form/ViewsExposedForm.php | |
index 36118c6..fe70bb1 100644 | |
--- a/docroot/core/modules/views/src/Form/ViewsExposedForm.php | |
+++ b/docroot/core/modules/views/src/Form/ViewsExposedForm.php | |
@@ -155,7 +155,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { | |
} | |
$view = $form_state->get('view'); | |
- $view->exposed_data = $form_state->getValues(); | |
+ $view->exposed_data = $form_state->getUserInput(); | |
$view->exposed_raw_input = []; | |
$exclude = array('submit', 'form_build_id', 'form_id', 'form_token', 'exposed_form_plugin', 'reset'); | |
@@ -163,7 +163,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { | |
$exposed_form_plugin = $view->display_handler->getPlugin('exposed_form'); | |
$exposed_form_plugin->exposedFormSubmit($form, $form_state, $exclude); | |
- foreach ($form_state->getValues() as $key => $value) { | |
+ foreach ($form_state->getUserInput() as $key => $value) { | |
if (!in_array($key, $exclude)) { | |
$view->exposed_raw_input[$key] = $value; | |
} | |
diff --git a/docroot/core/modules/views/src/Plugin/views/PluginBase.php b/docroot/core/modules/views/src/Plugin/views/PluginBase.php | |
index 1cc52f3..0eb2ae1 100644 | |
--- a/docroot/core/modules/views/src/Plugin/views/PluginBase.php | |
+++ b/docroot/core/modules/views/src/Plugin/views/PluginBase.php | |
@@ -374,7 +374,8 @@ protected function viewsTokenReplace($text, $tokens) { | |
assert('preg_match(\'/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/\', $top) === 1', 'Tokens need to be valid Twig variables.'); | |
$token_array = array(array_pop($parts) => $replacement); | |
foreach(array_reverse($parts) as $key) { | |
- assert('preg_match(\'/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/\', $key) === 1', 'Tokens need to be valid Twig variables.'); | |
+ // The key could also be numeric (array index) so also allow that. | |
+ assert('is_numeric($key) || (preg_match(\'/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/\', $key) === 1)', 'Tokens need to be valid Twig variables.'); | |
$token_array = array($key => $token_array); | |
} | |
if (!isset($twig_tokens[$top])) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment