protected property FieldConfigBase::$default_value

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();

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Field!FieldConfigBase.php/property/FieldConfigBase::default_value/8.1.x