You are here

public static function GoogleMapFieldType::propertyDefinitions in Google Map Field 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/GoogleMapFieldType.php, line 106

Class

GoogleMapFieldType
Plugin implementation of the 'Google Map' field type.

Namespace

Drupal\google_map_field\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['name'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Map Name'));
  $properties['lat'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Latitude'));
  $properties['lon'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Longitude'));
  $properties['zoom'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Map Zoom'));
  $properties['type'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Map Type'));
  $properties['width'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Map Width'));
  $properties['height'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Map Height'));
  $properties['marker'] = DataDefinition::create('integer')
    ->setLabel(new TranslatableMarkup('Show marker'));
  $properties['traffic'] = DataDefinition::create('integer')
    ->setLabel(new TranslatableMarkup('Traffic Layer'));
  $properties['marker_icon'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Custom marker'));
  $properties['controls'] = DataDefinition::create('integer')
    ->setLabel(new TranslatableMarkup('Show controls'));
  $properties['infowindow'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('InfoWindow message'));
  return $properties;
}