function pm_icon_l in Drupal PM (Project Management) 7
Same name and namespace in other branches
- 8 pm.module \pm_icon_l()
- 7.3 includes/pm.icon.inc \pm_icon_l()
- 7.2 pm.module \pm_icon_l()
Provides an icon link.
3 calls to pm_icon_l()
- pm_icon_add in ./
pm.module - Provides a Project Management add icon.
- pm_icon_delete in ./
pm.module - Provides a Project Management delete icon.
- pm_icon_edit in ./
pm.module - Provides a Project Management edit icon.
File
- ./
pm.module, line 736 - Main module file for the Project Management module.
Code
function pm_icon_l($icon, $path, $title, $params = array(), $attributes = array()) {
if (!drupal_valid_path($path)) {
return '';
}
$icon = pm_icon($icon, $title);
$attributes['title'] = $title;
$query = '';
if (array_key_exists('q', $params)) {
$destination = $params['q'];
unset($params['q']);
$c = 0;
if (array_key_exists('page', $params)) {
$destination .= '?page=' . $params['page'];
unset($params['page']);
$c++;
}
if (array_key_exists('sort', $params)) {
if ($c) {
$destination .= '&';
}
else {
$destination .= '?';
}
$destination .= 'sort=' . $params['sort'];
unset($params['sort']);
$c++;
}
if (array_key_exists('order', $params)) {
if ($c) {
$destination .= '&';
}
else {
$destination .= '?';
}
$destination .= 'order=' . $params['order'];
unset($params['order']);
$c++;
}
$query .= 'destination=' . urlencode($destination);
unset($params['destination']);
}
$params = _pm_icon_urlencode_helper($params);
foreach ($params as $key => $value) {
if ($query) {
$query .= '&';
}
$query .= $key . '=' . urlencode($value);
}
$o = l($icon, $path, array(
'attributes' => $attributes,
'html' => TRUE,
));
// @TODO add back query
return $o;
}