function ip_geoloc_marker_colors in IP Geolocation Views & Maps 8
Same name and namespace in other branches
- 7 ip_geoloc.module \ip_geoloc_marker_colors()
Return available marker colors for use in a select drop-down.
List is compiled based on available .png files in ip_geoloc/markers dir.
Return value
array Array of color names indexed by machine names
2 calls to ip_geoloc_marker_colors()
- IpGeoLocViewsPluginStyle::pluginStyleDiffColorTableRowForm in src/
Services/ IpGeoLocViewsPluginStyle.php - Diffs the color table plugin style row.
- _ip_geoloc_plugin_style_diff_color_table_row_form in src/
Plugin/ views/ style/ ip_geoloc_plugin_style.inc - Diffs the color table plugin style row.
File
- ./
ip_geoloc.module, line 589 - IPGV&M is a mapping engine for Views that contain locations of entities and/or visitors. Google Maps, Leaflet and OpenLayers2 maps are all supported and available through this module. Using a number of optional sources IPGV&M also retrieves…
Code
function ip_geoloc_marker_colors() {
$color_list =& drupal_static(__FUNCTION__);
if (!isset($color_list)) {
$color_list = [
'' => '<' . t('default') . '>',
0 => '<' . t('no marker') . '>',
];
if ($directory_handle = opendir(ip_geoloc_marker_directory())) {
while (($filename = readdir($directory_handle)) !== FALSE) {
if ($ext_pos = strrpos($filename, '.png')) {
$color = drupal_substr($filename, 0, $ext_pos);
// Ok... relies on translations done elsewhere.
$color_list[$color] = t($color);
}
}
closedir($directory_handle);
}
asort($color_list);
}
return $color_list;
}