You are here

function getdirections_get_nid_from_lid in Get Directions 7.3

Same name and namespace in other branches
  1. 6.2 getdirections.module \getdirections_get_nid_from_lid()
  2. 7.2 getdirections.module \getdirections_get_nid_from_lid()

File

./getdirections.module, line 1502
Fetches google map directions.

Code

function getdirections_get_nid_from_lid($lid) {
  if ($lid) {
    $query = FALSE;
    if (module_exists('getlocations_fields')) {
      $nid = getlocations_get_nid_from_lid($lid);
      if ($nid) {
        return $nid;
      }
    }
    elseif (module_exists('location')) {
      $query = db_select('location_instance', 'i')
        ->fields('i', array(
        'nid',
      ))
        ->condition('i.lid', $lid);
    }
    if ($query) {
      $row = $query
        ->execute()
        ->fetchAssoc();
      return isset($row['nid']) && $row['nid'] ? $row['nid'] : FALSE;
    }
  }
  return FALSE;
}