function _ip_geoloc_plugin_style_match_on_taxonomy_term_or_parent in IP Geolocation Views & Maps 7
Find a color association record for the suppplied taxonomy term id or name.
Parameters
string|array $differentiator_value, term id or term name:
array $diff_color_associations:
Return value
mixed, the matching association or FALSE, if none was found
This function does not support taxonomy tid RANGES, only single values.
1 call to _ip_geoloc_plugin_style_match_on_taxonomy_term_or_parent()
- _ip_geoloc_plugin_style_set_marker_color in views/
ip_geoloc_plugin_style.inc - Set the marker color based on the differentiator, if any.
File
- views/
ip_geoloc_plugin_style.inc, line 1095 - ip_geoloc_plugin_style.inc
Code
function _ip_geoloc_plugin_style_match_on_taxonomy_term_or_parent($differentiator_value, $diff_color_associations) {
// $differentiator_value may be tid (numeric) or term name (string).
if (isset($differentiator_value['tid'])) {
$tid = $differentiator_value['tid'];
}
elseif (is_numeric($differentiator_value)) {
$tid = $differentiator_value;
}
else {
$is_name = TRUE;
$tid = ip_geoloc_get_tid_from_name($differentiator_value);
}
// Starting with the current child find the first ancestor in the
// taxonomy hierarchy that matches.
foreach (taxonomy_get_parents_all($tid) as $term) {
$value = empty($is_name) ? $term->tid : $term->name;
$association = _ip_geoloc_plugin_style_find_association_by_differentiator_value($value, $diff_color_associations);
if (!empty($association)) {
return $association;
}
}
return FALSE;
}