Default field value.
The default value is used when an entity is created, either:
- through an entity creation form; the form elements for the field are prepopulated with the default value.
- through direct API calls (i.e. $entity->save()); the default value is added if the $entity object provides no explicit entry (actual values or "the field is empty") for the field.
The default value is expressed as a numerically indexed array of items, each item being an array of key/value pairs matching the set of 'columns' defined by the "field schema" for the field type, as exposed in hook_field_schema(). If the number of items exceeds the cardinality of the field, extraneous items will be ignored.
This property is overlooked if the $default_value_callback is non-empty.
Example for a integer field:
array( array('value' => 1), array('value' => 2), )
Type: array
File
- core/lib/Drupal/Core/Field/FieldConfigBase.php, line 142
Class
- FieldConfigBase
- Base class for configurable field definitions.
Namespace
Drupal\Core\Field
Code
protected $default_value = array();
Please login to continue.