You are here

function casetracker_views_field_createCaseLink_handler in Case Tracker 5

Views field handler; Get a link to add a case for a project @link http://drupal.org/node/99565

Parameters

array:

array:

mixed:

Return value

string

1 string reference to 'casetracker_views_field_createCaseLink_handler'
casetracker_views_tables in ./casetracker_views.module
Implementation of hook_views_table().

File

./casetracker_views.module, line 355
Enables Views integration for Case Tracker.

Code

function casetracker_views_field_createCaseLink_handler($fieldinfo, $fielddata, $value, $data) {
  $node_types = node_get_types('names');
  $case_types = array_filter(variable_get('casetracker_case_node_types', array(
    'casetracker_basic_case',
  )));
  $operations = array();
  foreach ($case_types as $case_type) {
    if ($fielddata['options']) {
      $linkText = $fielddata['options'];
    }
    else {
      $linkText = t('Add !name', array(
        '!name' => $node_types[$case_type],
      ));
    }
    $operations[] = l($linkText, 'node/add/' . $case_type . '/' . $data->nid);
  }
  return implode(' | ', $operations);
}