You are here

function getlocations_get_nodetype in Get Locations 7

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

Function to fetch a node type or bundle

Parameters

int $nid The node Identifier:

Return value

Returns the bundle name or false

3 calls to getlocations_get_nodetype()
getlocations_nids in ./getlocations.module
Page callback: Displays a map.
getlocations_search_info_sql in modules/getlocations_search/getlocations_search.module
getlocations_search_load_all_locations in modules/getlocations_search/getlocations_search.module

File

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

Code

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