You are here

function getlocations_get_tid_from_lid in Get Locations 7

Function to get tid from getlocations_fields_entities table.

Parameters

int $lid:

Return value

Returns tid.

1 call to getlocations_get_tid_from_lid()
getlocations_getinfo in ./getlocations.module

File

./getlocations.module, line 1819
getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_get_tid_from_lid($lid) {
  if (is_numeric($lid) && $lid) {
    $query = FALSE;
    if (module_exists('getlocations_fields')) {
      $query = db_select('getlocations_fields_entities', 'i')
        ->fields('i', array(
        'tid',
      ))
        ->condition('i.glid', $lid);
    }
    if ($query) {
      $row = $query
        ->execute()
        ->fetchAssoc();
      return isset($row['tid']) && $row['tid'] ? $row['tid'] : FALSE;
    }
  }
  return FALSE;
}