function getlocations_location_taxonomize_get_fields in Get Locations 7
Same name and namespace in other branches
- 7.2 modules/getlocations_location_taxonomize/getlocations_location_taxonomize.inc \getlocations_location_taxonomize_get_fields()
Returns the Getlocations Fields fields that can be used for the Location Vocabulary
Parameters
$assoc - whether to return an associative array (TRUE) or just an: indexed array (FALSE)
$labels - whether to return the labels of fields as array values:
1 call to getlocations_location_taxonomize_get_fields()
- _getlocations_location_taxonomize_variables in modules/
getlocations_location_taxonomize/ getlocations_location_taxonomize.inc - Keeps a list of all the variables maintained by this module, with their default values.
File
- modules/
getlocations_location_taxonomize/ getlocations_location_taxonomize.inc, line 40 - getlocations_location_taxonomize.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_location_taxonomize_get_fields($assoc = TRUE, $labels = FALSE) {
// get fields from getlocations_fields table
$defaults = array(
'columns' => array(
'glid' => t('Glid'),
'name' => t('Name'),
'street' => t('Street'),
'additional' => t('Additional'),
'city' => t('City'),
'province' => t('Province'),
'postal_code' => t('Post code'),
'country' => t('Country'),
'latitude' => t('Latitude'),
'longitude' => t('Longitude'),
),
);
$getlocations_fields_defaults = variable_get('getlocations_fields_defaults', $defaults);
if (function_exists('getlocations_fields_defaults')) {
$getlocations_fields_defaults = getlocations_fields_defaults();
}
$fields = $getlocations_fields_defaults['columns'];
foreach ($fields as $key => $value) {
$fields[$key] = $value;
}
// define the fields we support and their order
$supported = array(
'name',
'street',
'city',
'province',
'postal_code',
'country',
);
$return = array();
// remove unsupported fields
foreach ($supported as $field) {
if ($assoc) {
if ($labels) {
$return[$field] = $fields[$field];
}
else {
$return[$field] = $field;
}
}
else {
$return[] = $field;
}
}
return array_reverse($return);
}