You are here

function getlocations_other_get_fieldname in Get Locations 7.2

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

Function to collect field names

Parameters

string $type:

string $module:

string $entity_type:

Return value

Returns array of field names

3 calls to getlocations_other_get_fieldname()
getlocations_other_load_locations in ./getlocations.module
Function to fetch locations. Supports Geofield and Geolocation modules
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 2966
getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_other_get_fieldname($type, $module, $entity_type = '') {
  $query = db_select('field_config', 'fc');
  $query
    ->fields('fc', array(
    'field_name',
  ));
  $query
    ->join('field_config_instance', 'i', 'fc.id = i.field_id');
  $query
    ->condition('fc.module', $module);
  $query
    ->condition('fc.type', $type);
  $query
    ->condition('fc.active', 1);
  $query
    ->condition('fc.storage_active', 1);
  if (!empty($entity_type)) {
    $query
      ->condition('i.entity_type', $entity_type);
  }
  $rows = $query
    ->execute();
  $field_names = array();
  foreach ($rows as $row) {
    $field_names[$row->field_name] = $row->field_name;
  }
  return $field_names;
}