You are here

function leaflet_views_plugin_style::init in Leaflet 7

If this view is displaying an entity, save the entity type and info.

Overrides views_plugin_style::init

File

leaflet_views/leaflet_views_plugin_style.inc, line 14
Extension of the Views Plugin Style for Leaflet Map Adapted from the GeoField Map views module and the OpenLayers Views module.

Class

leaflet_views_plugin_style
@file Extension of the Views Plugin Style for Leaflet Map Adapted from the GeoField Map views module and the OpenLayers Views module.

Code

function init(&$view, &$display, $options = NULL) {
  parent::init($view, $display, $options);
  $this->entity_type = $this->options['entity_type'];
  $this->entity_info = entity_get_info($this->entity_type);

  // Fallback for views that do not have entity_type set, for example
  // because the view was created before this option got introduced.
  if (empty($this->entity_type)) {
    $info = $this
      ->getEntityInfoByTable($view->base_table);
    if (!empty($info)) {
      $this->entity_type = $info['entity type'];
      $this->entity_info = $info;
    }
  }
}