function PathItem::generateSampleValue

Overrides FieldItemBase::generateSampleValue

File

core/modules/path/src/Plugin/Field/FieldType/PathItem.php, line 109

Class

PathItem
Defines the 'path' entity field type.

Namespace

Drupal\path\Plugin\Field\FieldType

Code

public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
  $random = new Random();
  $values['alias'] = '/' . str_replace(' ', '-', strtolower($random->sentences(3)));
  return $values;
}

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