You are here

function theme_pm_dashboard_link in Drupal PM (Project Management) 8

Same name and namespace in other branches
  1. 7 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 66
Provides theme functions for Project Management modules.

Code

function theme_pm_dashboard_link($vars) {
  $link_array = $vars['link_blocks'];
  $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_icon', PM_ICON_SET_DEFAULT_BEHAVIOUR) !== PM_ICON_SET_NO_ICON) {
      $content .= '<dt class="pmcomponent">' . pm_helper_get_fa_icon($dt_id);
    }
    else {
      $content .= '<dt class="pmcomponent">';
    }
    $content .= $link;
    $content .= '</dt>';
  }
  else {
    $content = array(
      '#prefix' => variable_get('pm_icon', PM_ICON_SET_DEFAULT_BEHAVIOUR) !== PM_ICON_SET_NO_ICON ? '<dt class="pmcomponent">' . pm_helper_get_fa_icon($dt_id) : '<dt class="pmcomponent">',
      '#suffix' => '</dt>',
      '#value' => $link,
      '#weight' => $link_array['weight'],
    );
  }
  return $content;
}