You are here

public function GeolocationGeometry::getLocationsFromViewsRow in Geolocation Field 8.3

Get locations from views row.

Parameters

\Drupal\views\ResultRow $row: Row.

\Drupal\views\Plugin\views\field\FieldPluginBase $views_field: Views field definition.

Return value

array Renderable locations.

Overrides DataProviderBase::getLocationsFromViewsRow

File

modules/geolocation_geometry/src/Plugin/geolocation/DataProvider/GeolocationGeometry.php, line 134

Class

GeolocationGeometry
Provides GPX.

Namespace

Drupal\geolocation_geometry\Plugin\geolocation\DataProvider

Code

public function getLocationsFromViewsRow(ResultRow $row, FieldPluginBase $viewsField = NULL) {
  $locations = parent::getLocationsFromViewsRow($row, $viewsField);
  $current_style = $viewsField->displayHandler
    ->getPlugin('style');
  if (empty($current_style) || !is_subclass_of($current_style, 'Drupal\\geolocation\\Plugin\\views\\style\\GeolocationStyleBase')) {
    return $locations;
  }
  foreach ($locations as &$location) {
    if (!is_array($location)) {
      continue;
    }
    $location['#title'] = $current_style
      ->getTitleField($row);
    $location['#label'] = $current_style
      ->getLabelField($row);
  }
  return $locations;
}