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
!4384
Issue
#2975503
: allow FieldConfigInterface::setDefaultValueCallback() to accept a callback in service notation
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#2975503
: allow FieldConfigInterface::setDefaultValueCallback() to accept a callback in service notation
issue/drupal-2975503:2975503-field-default-callback-service
into
11.x
Overview
0
Commits
15
Pipelines
1
Changes
8
Open
Joachim Noreiko
requested to merge
issue/drupal-2975503:2975503-field-default-callback-service
into
11.x
1 year ago
Overview
0
Commits
15
Pipelines
1
Changes
8
Expand
0
0
Merge request reports
Compare
11.x
version 6
da9a65e6
1 year ago
version 5
bf68eb08
1 year ago
version 4
2b619efa
1 year ago
version 3
a7ba4e4f
1 year ago
version 2
269d6436
1 year ago
version 1
e0e9a03e
1 year ago
11.x (HEAD)
and
latest version
latest version
47b813b7
15 commits,
1 year ago
version 6
da9a65e6
15 commits,
1 year ago
version 5
bf68eb08
15 commits,
1 year ago
version 4
2b619efa
13 commits,
1 year ago
version 3
a7ba4e4f
12 commits,
1 year ago
version 2
269d6436
11 commits,
1 year ago
version 1
e0e9a03e
8 commits,
1 year ago
8 files
+
56
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
core/lib/Drupal/Core/Field/BaseFieldDefinition.php
+
2
−
1
Options
@@ -439,7 +439,8 @@ public function getDefaultValueCallback() {
public
function
getDefaultValue
(
FieldableEntityInterface
$entity
)
{
// Allow custom default values function.
if
(
$callback
=
$this
->
getDefaultValueCallback
())
{
$value
=
call_user_func
(
$callback
,
$entity
,
$this
);
$callable
=
\Drupal
::
service
(
'callable_resolver'
)
->
getCallableFromDefinition
(
$callback
);
$value
=
call_user_func
(
$callable
,
$entity
,
$this
);
}
else
{
$value
=
$this
->
getDefaultValueLiteral
();
Loading