function getlocations_get_fieldnames in Get Locations 7
Same name and namespace in other branches
- 7.2 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.
2 calls to getlocations_get_fieldnames()
- getlocations_blocks_block_configure in modules/
getlocations_blocks/ getlocations_blocks.module - Implements hook_block_configure().
- getlocations_fields_tokens in modules/
getlocations_fields/ getlocations_fields.functions.inc - Implements hook_tokens().
File
- ./
getlocations.module, line 5790 - 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;
}