ViewExecutable::getBaseEntityType

public ViewExecutable::getBaseEntityType()

Returns the entity type of the base table, if available.

Return value

\Drupal\Core\Entity\EntityType|false The entity type of the base table, or FALSE if none exists.

File

core/modules/views/src/ViewExecutable.php, line 977

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

public function getBaseEntityType() {
  if (!isset($this->baseEntityType)) {
    $view_base_table = $this->storage->get('base_table');
    $views_data = $this->viewsData->get($view_base_table);
    if (!empty($views_data['table']['entity type'])) {
      $entity_type_id = $views_data['table']['entity type'];
      $this->baseEntityType = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
    }
    else {
      $this->baseEntityType = FALSE;
    }
  }
  return $this->baseEntityType;
}
doc_Drupal
2016-10-29 09:54:19
Comments
Leave a Comment

Please login to continue.