function _ip_geoloc_plugin_style_get_base2 in IP Geolocation Views & Maps 8
Same name and namespace in other branches
- 7 views/ip_geoloc_plugin_style.inc \_ip_geoloc_plugin_style_get_base2()
Plugin style base.
1 call to _ip_geoloc_plugin_style_get_base2()
- _ip_geoloc_plugin_style_extract_lat_lng in src/
Plugin/ views/ style/ ip_geoloc_plugin_style.inc - Extract coordinates from the View result row.
File
- src/
Plugin/ views/ style/ ip_geoloc_plugin_style.inc, line 740 - ip_geoloc_plugin_style.inc
Code
function _ip_geoloc_plugin_style_get_base2($row, $field_name, $delta) {
if (!isset($row) || !isset($field_name) || !isset($delta)) {
return NULL;
}
if (isset($row->{$field_name}) && is_array($row->{$field_name})) {
if (!empty($row->{$field_name}[$delta]['raw'])) {
return $row->{$field_name}[$delta]['raw'];
// Geofield : field_<field_name>[0]['raw']['geom']
// Geolocation : field_<field_name>[0]['raw']['lat'] and ...]['lng']
// Get Locations: field_<field_name>[0]['raw']['latitude'].
}
$lang = LANGUAGE_NONE;
if (!empty($row->{$field_name}[$lang][$delta])) {
// EntityFieldQuery Views Backend.
// For Geofield module lat/long are as follows (note: no extra
// 'field_' prefix):
// <field_name>['und]['0']['wkt'], for example:
// POINT (144.976 -37.813) or MULTIPOINT ( (),(),() )
return $row->{$field_name}[$lang][$delta];
}
// Last resort, retrieve from rendered, as opposed to raw, result.
if (!empty($row->{$field_name}[$delta]['rendered'])) {
$base = $row->{$field_name}[$delta]['rendered'];
return empty($base['#markup']) ? $base : $base['#markup'];
}
}
return NULL;
}