public function ViewsNaturalSortService::getViewsBaseTable in Views Natural Sort 8.2
See also
EntityViewsData::getViewsData()
1 call to ViewsNaturalSortService::getViewsBaseTable()
- ViewsNaturalSortService::getSupportedEntityProperties in src/
ViewsNaturalSortService.php - Retrieve the full list of entities and properties that can be supported.
File
- src/
ViewsNaturalSortService.php, line 267
Class
- ViewsNaturalSortService
- Service that manages Views Natural Sort records.
Namespace
Drupal\views_natural_sortCode
public function getViewsBaseTable($fieldDefinition) {
$entityType = $this->entityTypeManager
->getDefinition($fieldDefinition
->getTargetEntityTypeId());
$base_table = $entityType
->getBaseTable() ?: $entityType
->id();
$views_revision_base_table = NULL;
$revisionable = $entityType
->isRevisionable();
$base_field = $entityType
->getKey('id');
$revision_table = '';
if ($revisionable) {
$revision_table = $entityType
->getRevisionTable() ?: $entityType
->id() . '_revision';
}
$translatable = $entityType
->isTranslatable();
$data_table = '';
if ($translatable) {
$data_table = $entityType
->getDataTable() ?: $entityType
->id() . '_field_data';
}
// Some entity types do not have a revision data table defined, but still
// have a revision table name set in
// \Drupal\Core\Entity\Sql\SqlContentEntityStorage::initTableLayout() so we
// apply the same kind of logic.
$revision_data_table = '';
if ($revisionable && $translatable) {
$revision_data_table = $entityType
->getRevisionDataTable() ?: $entityType
->id() . '_field_revision';
}
$revision_field = $entityType
->getKey('revision');
$views_base_table = $base_table;
if ($data_table) {
$views_base_table = $data_table;
}
//TODO Add support for finding Fields API Fields base tables. See views.views.inc.
return $views_base_table;
}