public function ViewsNaturalSortService::getSupportedEntityProperties in Views Natural Sort 8.2
Retrieve the full list of entities and properties that can be supported.
Return value
array An array of property information keyed by entity machine name. Example: [ 'node' => [ 'type' => [ 'base_table' => 'node', 'schema_field' => 'type', ] 'title' => [ 'base_table' => 'node', 'schema_field' => 'title', ] 'language' => [ 'base_table' => 'node', 'schema_field' => 'language', ] ] 'user' => [ 'name' => [ 'base_table' => 'users', 'schema_field' => 'name', ] 'mail' => [ 'base_table' => 'users', 'schema_field' => 'mail', ] 'theme' => [ 'base_table' => 'users', 'schema_field' => 'theme', ] ] 'file' => [ 'name' => [ 'base_table' => 'file_managed', 'schema_field' => 'filename', ] 'mime' => [ 'base_table' => 'file_managed', 'schema_field' => 'filemime', ] ] )
1 call to ViewsNaturalSortService::getSupportedEntityProperties()
File
- src/
ViewsNaturalSortService.php, line 135
Class
- ViewsNaturalSortService
- Service that manages Views Natural Sort records.
Namespace
Drupal\views_natural_sortCode
public function getSupportedEntityProperties() {
static $supported_properties = [];
if (empty($supported_properties)) {
foreach ($this->entityFieldManager
->getFieldMap() as $entity_type => $info) {
foreach ($info as $field_name => $field_info) {
if ($field_info['type'] == 'string') {
$field_configs = empty($field_info['bundles']) ? $this->entityFieldManager
->getBaseFieldDefinitions($entity_type) : $this->entityFieldManager
->getFieldDefinitions($entity_type, reset($field_info['bundles']));
if (!isset($field_configs[$field_name])) {
continue;
}
$field_config = $field_configs[$field_name];
if (empty($supported_properties[$entity_type])) {
$supported_properties[$entity_type] = [];
}
$base_table = $this
->getViewsBaseTable($field_config);
if (empty($base_table)) {
continue;
}
$supported_properties[$entity_type][$field_name] = [
'base_table' => $base_table,
// This may not be techincally correct. Research Further.
'schema_field' => $field_name,
];
}
}
}
/*$supported_properties = [
'node' => [
'title' => [
'base_table' => 'node_field_data',
'schema_field' => 'title',
],
],
];*/
}
return $supported_properties;
}