You are here

public function GeofieldGoogleMapViewStyle::init in Geofield Map 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/style/GeofieldGoogleMapViewStyle.php \Drupal\geofield_map\Plugin\views\style\GeofieldGoogleMapViewStyle::init()

Overrides \Drupal\views\Plugin\views\PluginBase::init().

The style options might come externally as the style can be sourced from at least two locations. If it's not included, look on the display.

Overrides StylePluginBase::init

File

src/Plugin/views/style/GeofieldGoogleMapViewStyle.php, line 194

Class

GeofieldGoogleMapViewStyle
Style plugin to render a View output as a Leaflet map.

Namespace

Drupal\geofield_map\Plugin\views\style

Code

public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
  parent::init($view, $display, $options);

  // For later use, set entity info related to the View's base table.
  $base_tables = array_keys($view
    ->getBaseTables());
  $base_table = reset($base_tables);
  foreach ($this->entityManager
    ->getDefinitions() as $key => $info) {
    if ($info
      ->getDataTable() == $base_table) {
      $this->entityType = $key;
      $this->entityInfo = $info;
      return;
    }
  }
}