You are here

function geofield_data_property_info in Geofield 7.2

Same name and namespace in other branches
  1. 7 geofield.module \geofield_data_property_info()

Defines info for the properties of the geofield field data structure.

1 call to geofield_data_property_info()
geofield_property_info_callback in ./geofield.schemaorg.inc
Callback to alter the property info of geofield fields.

File

./geofield.schemaorg.inc, line 56

Code

function geofield_data_property_info($name = NULL) {

  // Build an array of basic property information for the geofield field.
  // If any of these should have individual options to set microdata
  // properties is not clear. Lat, Lon work fine. Other data is more
  // complicated. Geo_type relates (not 1:1) with the itemprop within
  // a GeoShape, with an alternate representation of the wkt for the content
  // (at its simplest).
  $properties = array(
    'geom' => array(
      'label' => 'Well-known text',
      'type' => 'text',
      'microdata' => FALSE,
    ),
    'geo_type' => array(
      'label' => 'Geo Type',
      'options list' => '_geofield_geo_types_options_callback',
      'required' => TRUE,
      'microdata' => FALSE,
    ),
    'lat' => array(
      'label' => 'Latitude',
      'type' => 'decimal',
      'required' => TRUE,
      'setter callback' => 'entity_property_verbatim_set',
      'microdata' => TRUE,
    ),
    'lon' => array(
      'label' => 'Longitude',
      'type' => 'decimal',
      'required' => TRUE,
      'setter callback' => 'entity_property_verbatim_set',
      'microdata' => TRUE,
    ),
    'left' => array(
      'label' => 'Left Latitude',
      'type' => 'decimal',
      'setter callback' => 'entity_property_verbatim_set',
      'microdata' => FALSE,
    ),
    'top' => array(
      'label' => 'Top Longitude',
      'type' => 'decimal',
      'setter callback' => 'entity_property_verbatim_set',
      'microdata' => FALSE,
    ),
    'right' => array(
      'label' => 'Right Latitude',
      'type' => 'decimal',
      'setter callback' => 'entity_property_verbatim_set',
      'microdata' => FALSE,
    ),
    'bottom' => array(
      'label' => 'Bottom Longitude',
      'type' => 'decimal',
      'setter callback' => 'entity_property_verbatim_set',
      'microdata' => FALSE,
    ),
    'srid' => array(
      'label' => 'Projection (SRID)',
      'type' => 'integer',
      'microdata' => FALSE,
    ),
    'latlon' => array(
      'label' => 'LatLong Pair',
      'type' => 'string',
      'getter callback' => 'geofield_return_latlon',
      'microdata' => FALSE,
    ),
    'schemaorg_shape' => array(
      'label' => 'Schema.org Shape',
      'type' => 'string',
      'getter callback' => 'geofield_return_schemaorg_shape',
      'microdata' => TRUE,
    ),
  );

  // Add the default values for each of the geofield properties.
  foreach ($properties as $key => &$value) {
    $value += array(
      'description' => !empty($name) ? t('!label of field %name', array(
        '!label' => $value['label'],
        '%name' => $name,
      )) : '',
      'getter callback' => 'entity_property_verbatim_get',
    );
  }
  return $properties;
}