Verified Commit 169c75c5 authored by larowlan's avatar larowlan
Browse files

Issue #2917239 by Lendude, dww, iStryker: Form is built when not using fields

(cherry picked from commit 5888e036)
parent d5782064
......@@ -2450,9 +2450,11 @@ public function buildThemeFunctions($hook) {
* FALSE otherwise.
*/
public function hasFormElements() {
foreach ($this->field as $field) {
if (method_exists($field, 'viewsForm')) {
return TRUE;
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));
......
......@@ -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
......@@ -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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment