diff --git a/core/modules/views/src/Form/ViewsFormMainForm.php b/core/modules/views/src/Form/ViewsFormMainForm.php index 8ad9745..7cec64b 100644 --- a/core/modules/views/src/Form/ViewsFormMainForm.php +++ b/core/modules/views/src/Form/ViewsFormMainForm.php @@ -25,7 +25,7 @@ public function getFormId() { public function buildForm(array $form, FormStateInterface $form_state, ViewExecutable $view = NULL, $output = []) { $form['#prefix'] = '
'; $form['#suffix'] = '
'; - $form['#theme'] = 'form'; + $form['#pre_render'][] = 'views_pre_render_views_form_views_form'; // Add the output markup to the form array so that it's included when the form diff --git a/core/modules/views/src/Tests/Plugin/ViewsFormTest.php b/core/modules/views/src/Tests/Plugin/ViewsFormTest.php new file mode 100644 index 0000000..bbdd42a --- /dev/null +++ b/core/modules/views/src/Tests/Plugin/ViewsFormTest.php @@ -0,0 +1,39 @@ +drupalGet('test_bulk_form'); + // Ensure we have the form tag on the page. + $xpath = $this->cssSelect('.views-form form'); + $this->assertIdentical(count($xpath), 1, 'There is one views form on the page.'); + // Ensure we don't have nested form elements. + $result = (bool) preg_match('#]*?>(?!/form).*getRawContent()); + $this->assertFalse($result, 'The views form element is not nested.'); + } +} diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 22424a1..89a100e 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -676,10 +676,6 @@ function views_pre_render_views_form_views_form($element) { $output = str_replace($search, $replace, drupal_render($element['output'])); $element['output'] = ['#markup' => ViewsRenderPipelineSafeString::create($output)]; - // Sort, render and add remaining form fields. - $children = Element::children($element, TRUE); - $element['#children'] = drupal_render_children($element, $children); - return $element; }