You are here

function getdirections_get_fieldname in Get Directions 7.3

Get field names

Parameters

string $type:

string $module:

string $entity_type:

Return value

array field names

1 call to getdirections_get_fieldname()
getdirections_other_load_locations in ./getdirections.module
Load one or more locations For Geofield and Geolocation modules

File

./getdirections.module, line 1898
Fetches google map directions.

Code

function getdirections_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;
  }
  return $field_names;
}