public static function GeolocationItem::generateSampleValue in Geolocation Field 8
Same name and namespace in other branches
- 8.3 src/Plugin/Field/FieldType/GeolocationItem.php \Drupal\geolocation\Plugin\Field\FieldType\GeolocationItem::generateSampleValue()
- 8.2 src/Plugin/Field/FieldType/GeolocationItem.php \Drupal\geolocation\Plugin\Field\FieldType\GeolocationItem::generateSampleValue()
Generates placeholder field values.
Useful when populating site with placeholder content during site building or profiling.
Parameters
\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.
Return value
array An associative array of values.
Overrides FieldItemBase::generateSampleValue
File
- src/
Plugin/ Field/ FieldType/ GeolocationItem.php, line 106
Class
- GeolocationItem
- Plugin implementation of the 'geolocation' field type.
Namespace
Drupal\geolocation\Plugin\Field\FieldTypeCode
public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
$values['lat'] = rand(-90, 90) - rand(0, 999999) / 1000000;
$values['lng'] = rand(-180, 180) - rand(0, 999999) / 1000000;
return $values;
}