You are here

function uc_addresses_handler_field_uc_addresses_link_edit::render_link in Ubercart Addresses 7

Renders the link if the user may edit the address.

Overrides uc_addresses_handler_field_uc_addresses_link::render_link

File

views/uc_addresses_handler_field_uc_addresses_link_edit.inc, line 17
Definition of uc_addresses_handler_field_uc_addresses_link_edit.

Class

uc_addresses_handler_field_uc_addresses_link_edit
Field handler to present a link edit an address.

Code

function render_link($entity, $values) {
  if (!uc_addresses_entity_access('update', $entity)) {
    return;
  }
  $uri = entity_uri('uc_addresses', $entity);
  $this->options['alter']['make_link'] = TRUE;
  $this->options['alter']['path'] = $uri['path'] . '/edit';
  $this->options['alter']['query'] = drupal_get_destination();
  $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
  return $text;
}