Loading core/modules/views_ui/src/ViewPreviewForm.php +2 −2 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ public function form(array $form, FormStateInterface $form_state) { '#default_value' => \Drupal::config('views.settings')->get('ui.always_live_preview'), ]; // Add the arguments textfield // Add the arguments textfield. $form['controls']['view_args'] = [ '#type' => 'textfield', '#title' => $this->t('Preview with contextual filters:'), Loading @@ -49,7 +49,7 @@ public function form(array $form, FormStateInterface $form_state) { ]; $args = []; if (!$form_state->isValueEmpty('view_args')) { if ($form_state->getValue('view_args', '') !== '') { $args = explode('/', $form_state->getValue('view_args')); } Loading core/modules/views_ui/tests/src/Functional/PreviewTest.php +9 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,15 @@ public function testPreviewContextual() { ]); $this->assertSession()->elementsCount('xpath', $selector, 1); $this->submitForm($edit = ['view_args' => '100'], 'Update preview'); $this->submitForm(['view_args' => '100'], 'Update preview'); // Test that area text and exposed filters are present and rendered. $this->assertSession()->fieldExists('id'); $this->assertSession()->pageTextContains('Test header text'); $this->assertSession()->pageTextContains('Test footer text'); $this->assertSession()->pageTextContains('Test empty text'); $this->submitForm(['view_args' => '0'], 'Update preview'); // Test that area text and exposed filters are present and rendered. $this->assertSession()->fieldExists('id'); Loading Loading
core/modules/views_ui/src/ViewPreviewForm.php +2 −2 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ public function form(array $form, FormStateInterface $form_state) { '#default_value' => \Drupal::config('views.settings')->get('ui.always_live_preview'), ]; // Add the arguments textfield // Add the arguments textfield. $form['controls']['view_args'] = [ '#type' => 'textfield', '#title' => $this->t('Preview with contextual filters:'), Loading @@ -49,7 +49,7 @@ public function form(array $form, FormStateInterface $form_state) { ]; $args = []; if (!$form_state->isValueEmpty('view_args')) { if ($form_state->getValue('view_args', '') !== '') { $args = explode('/', $form_state->getValue('view_args')); } Loading
core/modules/views_ui/tests/src/Functional/PreviewTest.php +9 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,15 @@ public function testPreviewContextual() { ]); $this->assertSession()->elementsCount('xpath', $selector, 1); $this->submitForm($edit = ['view_args' => '100'], 'Update preview'); $this->submitForm(['view_args' => '100'], 'Update preview'); // Test that area text and exposed filters are present and rendered. $this->assertSession()->fieldExists('id'); $this->assertSession()->pageTextContains('Test header text'); $this->assertSession()->pageTextContains('Test footer text'); $this->assertSession()->pageTextContains('Test empty text'); $this->submitForm(['view_args' => '0'], 'Update preview'); // Test that area text and exposed filters are present and rendered. $this->assertSession()->fieldExists('id'); Loading