You are here

function getlocations_get_fieldnames in Get Locations 7.2

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

Fetch fieldnames for a given module and type

Parameters

array $module module name:

array $type type name:

Return value

array suitable for use in a dropdown.

3 calls to getlocations_get_fieldnames()
getlocations_blocks_block_configure in modules/getlocations_blocks/getlocations_blocks.module
Implements hook_block_configure().
getlocations_fields_load_locations in modules/getlocations_fields/getlocations_fields.module
getlocations_fields_tokens in modules/getlocations_fields/getlocations_fields.functions.inc
Implements hook_tokens().

File

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

Code

function getlocations_get_fieldnames($module = 'getlocations_fields', $type = 'getlocations_fields') {
  $field_names = array();
  $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('f.module', $module)
    ->condition('f.type', $type)
    ->condition('f.active', 1);
  $rows = $query
    ->execute();
  foreach ($rows as $row) {
    $field_names[$row->field_name] = $row->field_name;
  }
  return $field_names;
}