You are here

function _metatag_entity_type_from_table in Metatag 7

Work out the entity type based upon its primary table.

Parameters

string $table: The table name to check.

Return value

string The entity type.

1 call to _metatag_entity_type_from_table()
metatag_handler_field_entity::query in views/metatag_handler_field_entity.inc
Heavily modified code from views_hander_field_field::query().

File

views/metatag_handler_field_entity.inc, line 17
Main handler for Metatag data.

Code

function _metatag_entity_type_from_table($table) {
  $base_tables =& drupal_static(__FUNCTION__);
  if (empty($base_tables)) {
    foreach (entity_get_info() as $entity_type => $info) {
      $base_tables[$info['base table']] = $entity_type;
    }
  }
  return isset($base_tables[$table]) ? $base_tables[$table] : NULL;
}