Loading core/modules/views/src/ViewExecutable.php +5 −3 Original line number Diff line number Diff line Loading @@ -2450,11 +2450,13 @@ public function buildThemeFunctions($hook) { * FALSE otherwise. */ public function hasFormElements() { if ($this->getDisplay()->usesFields()) { foreach ($this->field as $field) { if (method_exists($field, 'viewsForm')) { return TRUE; } } } $area_handlers = array_merge(array_values($this->header), array_values($this->footer)); $empty = empty($this->result); foreach ($area_handlers as $area) { Loading core/modules/views/tests/modules/action_bulk_test/config/install/views.view.test_bulk_form.yml +27 −0 Original line number Diff line number Diff line Loading @@ -178,3 +178,30 @@ display: empty: false style: false path: test_bulk_form_empty page_3: id: page_3 display_title: 'Page 3' display_plugin: page position: 3 display_options: style: type: grid options: grouping: { } columns: 3 automatic_width: true alignment: horizontal row_class_custom: '' row_class_default: true col_class_custom: '' col_class_default: true row: type: 'entity:node' options: relationship: none view_mode: teaser defaults: style: false row: false display_extenders: { } path: display-without-fields core/modules/views/tests/src/Functional/Plugin/ViewsFormTest.php +6 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,12 @@ public function testFormWrapper() { // Ensure we don't have nested form elements. $result = (bool) preg_match('#<form[^>]*?>(?!/form).*<form#s', $this->getSession()->getPage()->getContent()); $this->assertFalse($result, 'The views form element is not nested.'); // Test the form isn't shown when the display doesn't use fields. $this->drupalGet('display-without-fields'); // Ensure there's no form. $xpath = $this->cssSelect('.views-form form'); $this->assertCount(0, $xpath); } } Loading
core/modules/views/src/ViewExecutable.php +5 −3 Original line number Diff line number Diff line Loading @@ -2450,11 +2450,13 @@ public function buildThemeFunctions($hook) { * FALSE otherwise. */ public function hasFormElements() { if ($this->getDisplay()->usesFields()) { foreach ($this->field as $field) { if (method_exists($field, 'viewsForm')) { return TRUE; } } } $area_handlers = array_merge(array_values($this->header), array_values($this->footer)); $empty = empty($this->result); foreach ($area_handlers as $area) { Loading
core/modules/views/tests/modules/action_bulk_test/config/install/views.view.test_bulk_form.yml +27 −0 Original line number Diff line number Diff line Loading @@ -178,3 +178,30 @@ display: empty: false style: false path: test_bulk_form_empty page_3: id: page_3 display_title: 'Page 3' display_plugin: page position: 3 display_options: style: type: grid options: grouping: { } columns: 3 automatic_width: true alignment: horizontal row_class_custom: '' row_class_default: true col_class_custom: '' col_class_default: true row: type: 'entity:node' options: relationship: none view_mode: teaser defaults: style: false row: false display_extenders: { } path: display-without-fields
core/modules/views/tests/src/Functional/Plugin/ViewsFormTest.php +6 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,12 @@ public function testFormWrapper() { // Ensure we don't have nested form elements. $result = (bool) preg_match('#<form[^>]*?>(?!/form).*<form#s', $this->getSession()->getPage()->getContent()); $this->assertFalse($result, 'The views form element is not nested.'); // Test the form isn't shown when the display doesn't use fields. $this->drupalGet('display-without-fields'); // Ensure there's no form. $xpath = $this->cssSelect('.views-form form'); $this->assertCount(0, $xpath); } }