You are here

public function IpGeoLocViewsPluginStyle::pluginStyleGetBase1 in IP Geolocation Views & Maps 8

Pending doc.

1 call to IpGeoLocViewsPluginStyle::pluginStyleGetBase1()
IpGeoLocViewsPluginStyle::pluginStyleExtractLocations in src/Services/IpGeoLocViewsPluginStyle.php
Extract an array of locations from the supplied views_plugin_style.

File

src/Services/IpGeoLocViewsPluginStyle.php, line 785

Class

IpGeoLocViewsPluginStyle
Class IpGeoLocViewsPluginStyle.

Namespace

Drupal\ip_geoloc\Services

Code

public function pluginStyleGetBase1($row, $location_field_name, $location_field_alias) {
  $base = NULL;
  if (isset($row->_entity)) {

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

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