Skip to content
Snippets Groups Projects

Issue #2975503: allow FieldConfigInterface::setDefaultValueCallback() to accept a callback in service notation

Open Issue #2975503: allow FieldConfigInterface::setDefaultValueCallback() to accept a callback in service notation
Files
8
@@ -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