function EmailItem::generateSampleValue

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php \Drupal\Core\Field\Plugin\Field\FieldType\EmailItem::generateSampleValue()
  2. 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php \Drupal\Core\Field\Plugin\Field\FieldType\EmailItem::generateSampleValue()
  3. 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php \Drupal\Core\Field\Plugin\Field\FieldType\EmailItem::generateSampleValue()

Overrides FieldItemBase::generateSampleValue

1 call to EmailItem::generateSampleValue()
EntityUser::processStubRow in core/modules/user/src/Plugin/migrate/destination/EntityUser.php

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php, line 76

Class

EmailItem
Defines the 'email' field type.

Namespace

Drupal\Core\Field\Plugin\Field\FieldType

Code

public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
    $random = new Random();
    $values['value'] = $random->name() . '@example.com';
    return $values;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.