You are here

protected function LeafletMap::getEntitySourceEntityInfo in Leaflet 2.0.x

Same name and namespace in other branches
  1. 8 modules/leaflet_views/src/Plugin/views/style/LeafletMap.php \Drupal\leaflet_views\Plugin\views\style\LeafletMap::getEntitySourceEntityInfo()
  2. 2.1.x modules/leaflet_views/src/Plugin/views/style/LeafletMap.php \Drupal\leaflet_views\Plugin\views\style\LeafletMap::getEntitySourceEntityInfo()

Get the entity info of the entity source.

Parameters

string $source: The Source identifier.

Return value

\Drupal\Core\Entity\EntityTypeInterface The entity type.

1 call to LeafletMap::getEntitySourceEntityInfo()
LeafletMap::buildOptionsForm in modules/leaflet_views/src/Plugin/views/style/LeafletMap.php
Provide a form to edit options for this plugin.

File

modules/leaflet_views/src/Plugin/views/style/LeafletMap.php, line 407

Class

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

Namespace

Drupal\leaflet_views\Plugin\views\style

Code

protected function getEntitySourceEntityInfo($source) {
  if (!empty($source) && $source != '__base_table') {
    $handler = $this->displayHandler
      ->getHandler('relationship', $source);
    $data = Views::viewsData();
    if (($table = $data
      ->get($handler->definition['base'])) && !empty($table['table']['entity type'])) {
      try {
        return $this->entityManager
          ->getDefinition($table['table']['entity type']);
      } catch (\Exception $e) {
        $entity_type = NULL;
      }
    }
  }
  return $this->view
    ->getBaseEntityType();
}