You are here

public function GeolocationGeometry::getShapesFromViewsRow in Geolocation Field 8.3

Get shapes from views row.

Parameters

\Drupal\views\ResultRow $row: Row.

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

Return value

array Renderable shapes.

Overrides DataProviderBase::getShapesFromViewsRow

File

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

Class

GeolocationGeometry
Provides GPX.

Namespace

Drupal\geolocation_geometry\Plugin\geolocation\DataProvider

Code

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