You are here

function pm_icon_l in Drupal PM (Project Management) 8

Same name and namespace in other branches
  1. 7.3 includes/pm.icon.inc \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 ./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 395
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']);
  }
  return l($icon, $path, array(
    'attributes' => $attributes,
    'html' => TRUE,
    'query' => _pm_icon_urlencode_helper($params),
  ));
}