Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
281129e2
Verified
Commit
281129e2
authored
May 14, 2022
by
larowlan
Browse files
Issue
#2917239
by Lendude, dww, iStryker: Form is built when not using fields
(cherry picked from commit
5888e036
)
parent
2ce50a6b
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/modules/views/src/ViewExecutable.php
View file @
281129e2
...
...
@@ -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
));
...
...
core/modules/views/tests/modules/action_bulk_test/config/install/views.view.test_bulk_form.yml
View file @
281129e2
...
...
@@ -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
View file @
281129e2
...
...
@@ -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
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment