Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
domain_entity
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
domain_entity
Merge requests
!5
Issue
#3252215
: Default domain values not being assigned while creating a new Entity
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3252215
: Default domain values not being assigned while creating a new Entity
issue/domain_entity-3252215:3252215-default-domain-values
into
8.x-1.x
Overview
0
Commits
2
Pipelines
0
Changes
1
Open
sonvir249
requested to merge
issue/domain_entity-3252215:3252215-default-domain-values
into
8.x-1.x
3 years ago
Overview
0
Commits
2
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Compare
8.x-1.x
version 1
67e2f1ae
3 years ago
8.x-1.x (HEAD)
and
latest version
latest version
5c77af0f
2 commits,
3 years ago
version 1
67e2f1ae
1 commit,
3 years ago
1 file
+
15
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
domain_entity.module
+
15
−
0
Options
@@ -593,6 +593,21 @@ function domain_entity_field_widget_single_element_form_alter(&$element, FormSta
if
(
$context
[
'items'
]
->
getFieldDefinition
()
->
getName
()
!==
DomainEntityMapper
::
FIELD_NAME
)
{
return
;
}
$form_object
=
$form_state
->
getFormObject
();
if
(
!
$form_object
instanceof
EntityFormInterface
)
{
return
;
}
// Get the current Entity information.
$entity
=
$form_object
->
getEntity
();
// Add Default value if we are creating a new Entity.
if
((
is_object
(
$entity
))
&&
(
$entity
->
isNew
()))
{
// Get active Domain ID.
$active_id
=
\Drupal
::
service
(
'domain.negotiator'
)
->
getActiveId
();
// Default value based on the current Active Domain.
$element
[
'#default_value'
]
=
[
$active_id
];
}
$form_object
=
$form_state
->
getFormObject
();
if
(
!
$form_object
instanceof
EntityFormInterface
)
{
Loading