Issue #2917239 by Lendude, dww, iStryker: Form is built when not using fields
(cherry picked from commit 5888e0367e
)
merge-requests/2281/head
parent
7ab8433616
commit
78d9626fff
|
@ -2450,9 +2450,11 @@ class ViewExecutable {
|
|||
* 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 @@ class ViewsFormTest extends ViewTestBase {
|
|||
// 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…
Reference in New Issue