diff --git a/contrib/location_entity/location_entity.info b/contrib/location_entity/location_entity.info index 0000000..d3d54e3 --- /dev/null +++ b/contrib/location_entity/location_entity.info @@ -0,0 +1,8 @@ +name = Location Entity +description = Provide information about Location field to Entity module. +core = 7.x +package = Location + +dependencies[] = location + +files[] = location_entity.module diff --git a/contrib/location_entity/location_entity.module b/contrib/location_entity/location_entity.module index 0000000..8d4e7d4 --- /dev/null +++ b/contrib/location_entity/location_entity.module @@ -0,0 +1,64 @@ + $item) { + $property['property info'][$key] = + array( + 'type' => $item['type'], + 'label' => $item['label'], + 'getter callback' => 'location_entity_field_verbatim_get', + ); + } +} + +/** + * Gets the data from field array. + */ +function location_entity_field_verbatim_get($item, array $options, $name, $entity_type) { + if (isset($item[$name]) && !empty($item[$name])) { + return $item[$name]; + } + return NULL; +} + + +/** + * Helper function that returns location key map array + */ +function location_entity_key_map() { + return array( + 'lid' => array('type' => 'integer', 'label' => t('Lid')), + 'latitude' => array('type' => 'decimal', 'label' => t('Latitude')), + 'longitude' => array('type' => 'decimal', 'label' => t('Longitude')), + 'name' => array('type' => 'text', 'label' => t('Name')), + 'street' => array('type' => 'text', 'label' => t('Street')), + 'additional' => array('type' => 'text', 'label' => t('Additional')), + 'city' => array('type' => 'text', 'label' => t('City')), + 'province' => array('type' => 'text', 'label' => t('Province')), + 'postal_code' => array('type' => 'text', 'label' => t('Postal code')), + 'country' => array('type' => 'text', 'label' => t('Country')), + 'province_name' => array('type' => 'text', 'label' => t('Province name')), + 'country_name' => array('type' => 'text', 'label' => t('Country name')), + ); +}