Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Merge requests
!8607
Issue
#3053890
: SubformState should complain when the subform doesn't have #tree = TRUE
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3053890
: SubformState should complain when the subform doesn't have #tree = TRUE
issue/drupal-3053890:3053890-subformstate-should-complain
into
11.x
Overview
0
Commits
5
Pipelines
2
Changes
3
Open
Soham Sengupta
requested to merge
issue/drupal-3053890:3053890-subformstate-should-complain
into
11.x
11 months ago
Overview
0
Commits
5
Pipelines
2
Changes
3
Expand
Closes
#3053890
0
0
Merge request reports
Compare
11.x
version 1
2c43e466
11 months ago
11.x (HEAD)
and
latest version
latest version
4ae90903
5 commits,
9 months ago
version 1
2c43e466
1 commit,
11 months ago
3 files
+
35
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
core/lib/Drupal/Core/Form/SubformState.php
+
12
−
0
Options
@@ -56,8 +56,20 @@ protected function __construct(array &$subform, array &$parent_form, FormStateIn
* The subform form object when it's not the same as the parent form.
*
* @return static
*
* @throws \Exception
* Exception is thrown when the #tree property of the subform
* is not set, as it is required for this class to work properly.
*/
public
static
function
createForSubform
(
array
&
$subform
,
array
&
$parent_form
,
FormStateInterface
$parent_form_state
,
?FormInterface
$subform_form_object
=
NULL
)
{
// In case of non empty subforms, the #tree property of the subform must be
// set. Without it, the subform's form values are the top of the values
// array, and SubformState::getValues() won't find them.
if
(
!
empty
(
$subform
))
{
if
(
!
isset
(
$subform
[
'#tree'
])
||
!
$subform
[
'#tree'
])
{
throw
new
\Exception
(
"The #tree attribute of the subform is not set"
);
}
}
return
new
static
(
$subform
,
$parent_form
,
$parent_form_state
,
$subform_form_object
);
}
Loading