You are here

function getlocations_get_vid in Get Locations 7

Same name and namespace in other branches
  1. 6.2 getlocations.module \getlocations_get_vid()
  2. 6 getlocations.module \getlocations_get_vid()
  3. 7.2 getlocations.module \getlocations_get_vid()

Function to get the vid from node table.

Parameters

int $nid:

Return value

Returns vid.

3 calls to getlocations_get_vid()
getlocations_nids in ./getlocations.module
Page callback: Displays a map.
getlocations_nodemap in ./getlocations.module
Page callback: displays a map.
getlocations_typemap in ./getlocations.module
Page callback: Displays a map.

File

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

Code

function getlocations_get_vid($nid) {
  if (is_numeric($nid) && $nid) {
    $query = db_select('node', 'n')
      ->fields('n', array(
      'vid',
    ))
      ->condition('n.nid', $nid);
    $row = $query
      ->execute()
      ->fetchAssoc();
    return isset($row['vid']) && $row['vid'] ? $row['vid'] : FALSE;
  }
  return FALSE;
}