function getlocations_get_markertypes in Get Locations 7
Same name and namespace in other branches
- 6.2 getlocations.module \getlocations_get_markertypes()
- 6 getlocations.module \getlocations_get_markertypes()
Function to fetch list of markers
Parameters
string $type:
Return value
Returns list of markers
8 calls to getlocations_get_markertypes()
- getlocations_leaflet_entity_type_map in modules/
getlocations_leaflet/ getlocations_leaflet.module - Function
- getlocations_mapquest_entity_type_map in modules/
getlocations_mapquest/ getlocations_mapquest.module - Function
- getlocations_nids in ./
getlocations.module - Page callback: Displays a map.
- getlocations_nodemap in ./
getlocations.module - Page callback: displays a map.
- getlocations_search_info_sql in modules/
getlocations_search/ getlocations_search.module
File
- ./
getlocations.module, line 2671 - getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_get_markertypes($type) {
$getlocations_defaults = getlocations_defaults();
$markertypes = array();
if ($type == 'node') {
$default_marker = $getlocations_defaults['node_map_marker'];
$getlocations_node_marker = variable_get('getlocations_node_marker', array(
'enable' => 0,
));
if ($getlocations_node_marker['enable']) {
if ($content_types = getlocations_get_types()) {
foreach ($content_types as $content_type => $name) {
$field_names = getlocations_get_fieldname2($content_type, 'node');
foreach ($field_names as $field_name) {
if (isset($getlocations_node_marker['content_type'][$content_type]['field_name'][$field_name]['map_marker'])) {
$markertypes[$content_type] = $getlocations_node_marker['content_type'][$content_type]['field_name'][$field_name]['map_marker'];
}
else {
$markertypes[$content_type] = $default_marker;
}
}
}
}
}
return $markertypes;
}
elseif ($type == 'vocabulary' && module_exists('taxonomy')) {
$default_marker = $getlocations_defaults['vocabulary_map_marker'];
$vocabularies = getlocations_get_vocabularies();
$getlocations_vocabulary_marker = variable_get('getlocations_vocabulary_marker', array(
'enable' => 0,
));
foreach ($vocabularies as $vid => $vocabulary) {
if ($getlocations_vocabulary_marker['enable'] && isset($getlocations_vocabulary_marker['vocabulary'][$vid]['map_marker'])) {
$markertypes[$vid] = $getlocations_vocabulary_marker['vocabulary'][$vid]['map_marker'];
}
else {
$markertypes[$vid] = $default_marker;
}
}
return $markertypes;
}
elseif ($type == 'term' && module_exists('taxonomy')) {
$default_marker = $getlocations_defaults['term_map_marker'];
$getlocations_term_marker = variable_get('getlocations_term_marker', array(
'enable' => 0,
'vids' => 0,
'max_depth' => '',
));
if ($getlocations_term_marker['enable'] && $getlocations_term_marker['vids']) {
$depth = is_numeric($getlocations_term_marker['max_depth']) && $getlocations_term_marker['max_depth'] > 0 ? $getlocations_term_marker['max_depth'] : NULL;
$vids = $getlocations_term_marker['vids'];
foreach ($vids as $vid) {
$terms = taxonomy_get_tree($vid, 0, $depth);
foreach ($terms as $term) {
if (isset($getlocations_term_marker['vid'][$vid]['term'][$term->tid]['map_marker'])) {
$markertypes[$term->tid] = $getlocations_term_marker['vid'][$vid]['term'][$term->tid]['map_marker'];
}
else {
$markertypes[$term->tid] = $default_marker;
}
}
}
}
return $markertypes;
}
else {
return FALSE;
}
}