public static function GeolocationGeometryBase::generateSampleValue in Geolocation Field 8.3
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
1 method overrides GeolocationGeometryBase::generateSampleValue()
- GeolocationGeometryPolygon::generateSampleValue in modules/
geolocation_geometry/ src/ Plugin/ Field/ FieldType/ GeolocationGeometryPolygon.php - Generates placeholder field values.
File
- modules/
geolocation_geometry/ src/ Plugin/ Field/ FieldType/ GeolocationGeometryBase.php, line 145
Class
- GeolocationGeometryBase
- Class Geolocation Geometry Base.
Namespace
Drupal\geolocation_geometry\Plugin\Field\FieldTypeCode
public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
$coordinates = self::getRandomCoordinates();
$values['geojson'] = '{"type": "Point", "coordinates": [' . $coordinates['longitude'] . ', ' . $coordinates['latitude'] . ']}';
return $values;
}