function UriItem::generateSampleValue
Same name in other branches
- 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php \Drupal\Core\Field\Plugin\Field\FieldType\UriItem::generateSampleValue()
- 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php \Drupal\Core\Field\Plugin\Field\FieldType\UriItem::generateSampleValue()
- 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php \Drupal\Core\Field\Plugin\Field\FieldType\UriItem::generateSampleValue()
Overrides StringItem::generateSampleValue
1 call to UriItem::generateSampleValue()
- EntityFile::processStubRow in core/
modules/ file/ src/ Plugin/ migrate/ destination/ EntityFile.php - Populates as much of the stub row as possible.
File
-
core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ UriItem.php, line 79
Class
- UriItem
- Defines the 'uri' entity field type.
Namespace
Drupal\Core\Field\Plugin\Field\FieldTypeCode
public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
$values = parent::generateSampleValue($field_definition);
$suffix_length = $field_definition->getSetting('max_length') - 7;
foreach ($values as $key => $value) {
$values[$key] = 'http://' . mb_substr($value, 0, $suffix_length);
}
return $values;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.