You are here

public static function GeofieldItem::propertyDefinitions in Geofield 8

Defines field item properties.

Properties that are required to constitute a valid, non-empty item should be denoted with \Drupal\Core\TypedData\DataDefinition::setRequired().

Return value

\Drupal\Core\TypedData\DataDefinitionInterface[] An array of property definitions of contained properties, keyed by property name.

Overrides FieldItemInterface::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

src/Plugin/Field/FieldType/GeofieldItem.php, line 124

Class

GeofieldItem
Plugin implementation of the 'geofield' field type.

Namespace

Drupal\geofield\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['value'] = DataDefinition::create('string')
    ->setLabel(t('Geometry'))
    ->addConstraint('GeoType', []);
  $properties['geo_type'] = DataDefinition::create('string')
    ->setLabel(t('Geometry Type'));
  $properties['lat'] = DataDefinition::create('float')
    ->setLabel(t('Centroid Latitude'));
  $properties['lon'] = DataDefinition::create('float')
    ->setLabel(t('Centroid Longitude'));
  $properties['left'] = DataDefinition::create('float')
    ->setLabel(t('Left Bounding'));
  $properties['top'] = DataDefinition::create('float')
    ->setLabel(t('Top Bounding'));
  $properties['right'] = DataDefinition::create('float')
    ->setLabel(t('Right Bounding'));
  $properties['bottom'] = DataDefinition::create('float')
    ->setLabel(t('Bottom Bounding'));
  $properties['geohash'] = DataDefinition::create('string')
    ->setLabel(t('Geohash'));
  $properties['latlon'] = DataDefinition::create('string')
    ->setLabel(t('LatLong Pair'));
  return $properties;
}