You are here

function getlocations_get_fieldname in Get Locations 7.2

Same name and namespace in other branches
  1. 7 getlocations.module \getlocations_get_fieldname()

Function to collect field name

Parameters

string $bundle:

string $entity_type:

Return value

Returns field name or FALSE

4 calls to getlocations_get_fieldname()
getlocations_mapquest_field_formatter_view in modules/getlocations_mapquest/getlocations_mapquest.module
Implements hook_field_formatter_view(). Build a renderable array for a field value.
template_preprocess_getlocations_leaflet_view_map in modules/getlocations_leaflet/views/getlocations_leaflet.views.inc
Preprocess function for getlocations_leaflet_view_map.tpl
template_preprocess_getlocations_mapquest_view_map in modules/getlocations_mapquest/views/getlocations_mapquest.views.inc
Preprocess function for getlocations_mapquest_view_map.tpl
template_preprocess_getlocations_view_map in views/getlocations.views.inc
Preprocess function for getlocations_view_map.tpl.

File

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

Code

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