You are here

function getlocations_check_node in Get Locations 7

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

Function to check if bundle has a locative field

Parameters

string $bundle:

Return value

Returns boolean

1 call to getlocations_check_node()
getlocations_get_types in ./getlocations.module
Function to fetch node types

File

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

Code

function getlocations_check_node($bundle) {
  $module = getlocations_get_current_supported_module();
  if ($module) {
    $query = db_select('field_config', 'f');
    $query
      ->fields('f', array(
      'id',
    ));
    $query
      ->join('field_config_instance', 'i', 'f.id=i.field_id');
    $query
      ->condition('i.bundle', $bundle)
      ->condition('f.module', $module)
      ->condition('i.entity_type', 'node')
      ->condition('f.active', 1);
    $rows = $query
      ->execute();
    $ct = 0;
    foreach ($rows as $row) {
      $ct++;
    }
    if ($ct) {
      return TRUE;
    }
  }
  return FALSE;
}