function FieldConfigInterface::setDefaultValue
Same name in other branches
- 9 core/lib/Drupal/Core/Field/FieldConfigInterface.php \Drupal\Core\Field\FieldConfigInterface::setDefaultValue()
- 10 core/lib/Drupal/Core/Field/FieldConfigInterface.php \Drupal\Core\Field\FieldConfigInterface::setDefaultValue()
- 11.x core/lib/Drupal/Core/Field/FieldConfigInterface.php \Drupal\Core\Field\FieldConfigInterface::setDefaultValue()
Sets a default value.
Note that if a default value callback is set, it will take precedence over any value set here.
Parameters
mixed $value: The default value for the field. This can be either:
- a literal, in which case it will be assigned to the first property of the first item.
- a numerically indexed array of items, each item being a property/value array.
- a non-numerically indexed array, in which case the array is assumed to be a property/value array and used as the first item
- NULL or array() for no default value.
Return value
$this
1 method overrides FieldConfigInterface::setDefaultValue()
- FieldConfigBase::setDefaultValue in core/
lib/ Drupal/ Core/ Field/ FieldConfigBase.php - Sets a default value.
File
-
core/
lib/ Drupal/ Core/ Field/ FieldConfigInterface.php, line 131
Class
- FieldConfigInterface
- Defines an interface for configurable field definitions.
Namespace
Drupal\Core\FieldCode
public function setDefaultValue($value);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.