You are here

function theme_pm_dashboard_link in Drupal PM (Project Management) 7

Same name and namespace in other branches
  1. 8 pm.theme.inc \theme_pm_dashboard_link()
  2. 7.2 pm.theme.inc \theme_pm_dashboard_link()

Provides HTML for Project Management links.

2 theme calls to theme_pm_dashboard_link()
theme_pm_dashboard in ./pm.theme.inc
Provides HTML for a Project Management dashboard.
theme_pm_dashboard_block in ./pm.theme.inc
Provides HTML for the Project Management dashboard blocks.

File

./pm.theme.inc, line 121
Provides theme functions for Project Management modules

Code

function theme_pm_dashboard_link($link_array) {
  $content = '';

  // DEFAULT ICON
  if (empty($link_array['icon'])) {
    $dt_id = 'pmexpenses';
  }
  else {
    $dt_id = $link_array['icon'];
  }
  $params = array();
  if (!empty($link_array['nid'])) {
    $params_key = $link_array['node_type'] . '_nid';
    $params['query'] = array(
      $params_key => $link_array['nid'],
    );
  }
  $link = l($link_array['title'], $link_array['path'], $params);

  // ADD PLUS SIGN (node/add)
  if (!empty($link_array['add_type'])) {
    $item = new stdClass();
    $item->type = $link_array['add_type'];
    if (empty($link_array['params'])) {
      $link_array['params'] = array();
    }
    $link .= pm_icon_add('node/add/' . str_replace('_', '-', $link_array['add_type']), $item, $link_array['params']);
  }
  if (empty($link_array['nid']) || 0 == $link_array['nid']) {
    if (variable_get('pm_icons_display', TRUE)) {
      $content .= '<dt id="' . $dt_id . '" class="pmcomponent">';
    }
    else {
      $content .= '<dt class="pmcomponent">';
    }
    $content .= $link;
    $content .= '</dt>';
  }
  else {
    $content = array(
      '#prefix' => variable_get('pm_icons_display', TRUE) ? '<dt id="' . $dt_id . '" class="pmcomponent">' : '<dt class="pmcomponent">',
      '#suffix' => '</dt>',
      '#value' => $link,
      '#weight' => $link_array['weight'],
    );
  }
  return $content;
}