You are here

function _ip_geoloc_plugin_style_get_base1 in IP Geolocation Views & Maps 7

Same name and namespace in other branches
  1. 8 src/Plugin/views/style/ip_geoloc_plugin_style.inc \_ip_geoloc_plugin_style_get_base1()
1 call to _ip_geoloc_plugin_style_get_base1()
ip_geoloc_plugin_style_extract_locations in views/ip_geoloc_plugin_style.inc
Extract an array of locations from the supplied views_plugin_style.

File

views/ip_geoloc_plugin_style.inc, line 861
ip_geoloc_plugin_style.inc

Code

function _ip_geoloc_plugin_style_get_base1($row, $location_field_name, $location_field_alias) {
  $base = NULL;
  if (isset($row->_field_data[$location_field_alias]['entity'])) {

    // The lines below are stripped back fast versions of this call:
    // $loc_field_value = $loc_field->get_value($row);
    $entity = $row->_field_data[$location_field_alias]['entity'];

    // The field value may not be there, i.e. no coordinates entered.
    if (isset($entity->{$location_field_name})) {
      $location_field_value = reset($entity->{$location_field_name});
      $base = is_array($location_field_value) ? reset($location_field_value) : $location_field_value;
    }
  }
  return $base;
}