function pm_icon in Drupal PM (Project Management) 8
Same name and namespace in other branches
- 7.3 includes/pm.icon.inc \pm_icon()
- 7 pm.module \pm_icon()
- 7.2 pm.module \pm_icon()
Provides a Project Management icon.
2 calls to pm_icon()
- pm_handler_area_addcontent::render in includes/
views/ pm_handler_area_addcontent.inc - Render the area.
- pm_icon_l in ./
pm.module - Provides an icon link.
5 string references to 'pm_icon'
- pm_admin_settings in includes/
pm.settings.inc - Defines the administration settings form.
- pm_helper_get_fa_icon in ./
pm.module - Helper to attach fontawesome icons.
- pm_preprocess_html in ./
pm.module - Set body class to use pm default icons if required.
- pm_update_7200 in ./
pm.install - Migrate pm_icons_display settings to new pm_icon variable.
- theme_pm_dashboard_link in ./
pm.theme.inc - Provides HTML for Project Management links.
File
- ./
pm.module, line 471 - Main module file for the Project Management module.
Code
function pm_icon($icon, $title) {
// Running check_plain() on these variables means that we can call pm_icon()
// without further sanitising.
$icon = check_plain($icon);
$title = check_plain($title);
$icon = str_replace(' ', '_', $icon);
if (variable_get('pm_icon', PM_ICON_SET_DEFAULT_BEHAVIOUR) !== PM_ICON_SET_NO_ICON) {
$fa_icon = pm_helper_get_fa_icon($icon, '');
// @todo: Should we force default? what if other module handles the icon?
if (empty($fa_icon)) {
return pm_icon_default($icon, $title);
}
else {
return $fa_icon;
}
}
else {
// Icons set to not display.
return '<span class="pm-no-icon">' . $title . '</span>';
}
}