You are here

public function pm_handler_field_operation::render in Drupal PM (Project Management) 7.3

Same name and namespace in other branches
  1. 8 includes/views/pm_handler_field_operation.inc \pm_handler_field_operation::render()
  2. 7 pm_handler_field_operation.inc \pm_handler_field_operation::render()
  3. 7.2 includes/views/pm_handler_field_operation.inc \pm_handler_field_operation::render()

Renders field to show icon.

Overrides views_handler_field_node_link::render

File

includes/views/pm_handler_field_operation.inc, line 36
Field handler for PM operation (edit and delete) links.

Class

pm_handler_field_operation
Field handler for PM operation (edit and delete) links.

Code

public function render($values) {
  if ($node = $this
    ->get_value($values)) {
    $id = $node->nid;
    if ($this->options['display_icons']) {
      module_load_include('inc', 'pm', 'includes/pm.icon');
      $value = "";
      $value .= pm_icon_edit_node($node, $_GET);
      if (!empty($value)) {
        $value .= ' ';
      }
      $value .= pm_icon_delete_node($node, $_GET);
      return $value;
    }
    else {
      $links = array();
      if ($link = $this
        ->create_link_definition(t('edit'), "node/{$id}/edit")) {
        $links[] = $link;
      }
      if ($link = $this
        ->create_link_definition(t('delete'), "node/{$id}/delete")) {
        $links[] = $link;
      }
      if ($link = $this
        ->create_link_definition(t('view'), "node/{$id}")) {
        $links[] = $link;
      }
      $vars = array(
        'title' => t('Quick Links'),
        'links' => $links,
      );
      return theme('links', $vars);
    }
  }
}