You are here

function commerce_file_handler_field_license_link_clone::render in Commerce File 7

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides commerce_file_handler_field_license_link::render

File

views/handlers/commerce_file_handler_field_license_link_clone.inc, line 12
Field handler for a license edit link.

Class

commerce_file_handler_field_license_link_clone
Field handler to present a license edit link.

Code

function render($values) {
  $entity_id = $this
    ->get_value($values, 'license_id');
  if (!empty($entity_id)) {
    $entity = commerce_file_license_load($entity_id);
    if ($entity
      ->access('create') && ($uri = $entity
      ->uri())) {
      $text = !empty($this->options['text']) ? $this->options['text'] : t('clone');
      return l($text, $uri['path'] . '/clone', array(
        'query' => drupal_get_destination(),
      ) + $uri);
    }
  }
}