You are here

function pm_icon_l in Drupal PM (Project Management) 7.3

Same name and namespace in other branches
  1. 8 pm.module \pm_icon_l()
  2. 7 pm.module \pm_icon_l()
  3. 7.2 pm.module \pm_icon_l()

Provides an icon link.

3 calls to pm_icon_l()
pm_icon_add in includes/pm.icon.inc
Provides a Project Management add icon.
pm_icon_delete in includes/pm.icon.inc
Provides a Project Management delete icon.
pm_icon_edit in includes/pm.icon.inc
Provides a Project Management edit icon.

File

includes/pm.icon.inc, line 56
Icon handling by Drupal PM.

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']);
  }
  return l($icon, $path, array(
    'attributes' => $attributes,
    'html' => TRUE,
    'query' => _pm_icon_urlencode_helper($params),
  ));
}