public function UuidItem::applyDefaultValue in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UuidItem.php \Drupal\Core\Field\Plugin\Field\FieldType\UuidItem::applyDefaultValue()
Applies the default value.
Parameters
bool $notify: (optional) Whether to notify the parent object of the change. Defaults to TRUE. If a property is updated from a parent object, set it to FALSE to avoid being notified again.
Return value
$this Returns itself to allow for chaining.
Overrides Map::applyDefaultValue
File
- core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ UuidItem.php, line 36
Class
- UuidItem
- Defines the 'uuid' entity field type.
Namespace
Drupal\Core\Field\Plugin\Field\FieldTypeCode
public function applyDefaultValue($notify = TRUE) {
// Default to one field item with a generated UUID.
$uuid = \Drupal::service('uuid');
$this
->setValue([
'value' => $uuid
->generate(),
], $notify);
return $this;
}