You are here

function getlocations_get_fieldname in Get Locations 7

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

Function to collect field name

Parameters

string $bundle:

string $entity_type:

Return value

Returns field name or FALSE

14 calls to getlocations_get_fieldname()
getlocations_fields_field_formatter_view in modules/getlocations_fields/getlocations_fields.module
Implements hook_field_formatter_view(). Build a renderable array for a field value.
getlocations_leaflet_field_formatter_view in modules/getlocations_leaflet/getlocations_leaflet.module
Implements hook_field_formatter_view(). Build a renderable array for a field value.
getlocations_leaflet_plugin_style::options_form in modules/getlocations_leaflet/views/getlocations_leaflet_plugin_style.inc
Options form
getlocations_leaflet_plugin_style::option_definition in modules/getlocations_leaflet/views/getlocations_leaflet_plugin_style.inc
Information about options for all kinds of purposes will be held here.
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.

... See full list

File

./getlocations.module, line 2457
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;
}