You are here

function hosting_site_field_handler_canonical::render in Hosting 7.3

Same name and namespace in other branches
  1. 7.4 site/includes/views/handlers/hosting_site_handler_field_canonical.inc \hosting_site_field_handler_canonical::render()

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides views_handler_field::render

File

site/includes/views/handlers/hosting_site_handler_field_canonical.inc, line 7
Views handler for canonical URLs.

Class

hosting_site_field_handler_canonical
@file Views handler for canonical URLs.

Code

function render($values) {
  $nid = $values->{$this->field_alias};
  $node = node_load($nid);

  // Use the redirection target, if it's available.
  if (is_object($node) && $node->type == 'site') {
    return hosting_site_canonical_url($node);
  }

  // Fall back to the task node title.
  if (isset($values->node_hosting_task_title)) {
    return $values->node_hosting_task_title;
  }

  // Default to the node title.
  if (isset($values->node_title)) {
    return $values->node_title;
  }
}