function panopoly_magic_get_entity_type in Panopoly Magic 7
Helper function to get the entity type retrieved by a view
1 call to panopoly_magic_get_entity_type()
File
- ./
panopoly_magic.module, line 1948
Code
function panopoly_magic_get_entity_type($view) {
$result = 'node';
if (isset($view->base_table) && $view->base_table != 'node') {
// Find the entity type with the corresponding base table.
$base_table = $view->base_table;
$entity_types = entity_get_info();
foreach ($entity_types as $entity_type => $entity_type_info) {
if ($entity_type_info['base table'] == $base_table) {
$result = $entity_type;
break;
}
}
}
return $result;
}