uc_addresses_handler_field_uc_addresses_link_delete.inc in Ubercart Addresses 6.2
Same filename and directory in other branches
Definition of views_handler_field_node_link_delete.
File
views/uc_addresses_handler_field_uc_addresses_link_delete.incView source
<?php
/**
* @file
* Definition of views_handler_field_node_link_delete.
*/
/**
* Field handler to present a link to delete an address.
*
* @ingroup views_field_handlers
*/
class uc_addresses_handler_field_uc_addresses_link_delete extends uc_addresses_handler_field_uc_addresses_link {
/**
* Renders the link if the user may delete the address.
*
* Note that because default addresses may not be deleted,
* user 1 may see no delete links either for some addresses.
*
* @param UcAddressesAddress $address
* An address object.
*
* @return string
* The rendered link, if the current user has access.
*/
function uc_addresses_render_link(UcAddressesAddress $address) {
$address_user = user_load($address
->getUserId());
if (UcAddressesPermissions::canDeleteAddress($address_user, $address)) {
$uri = $address
->uri();
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = $uri['path'] . '/delete';
$this->options['alter']['query'] = drupal_get_destination();
$text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
return $text;
}
}
}
Classes
Name | Description |
---|---|
uc_addresses_handler_field_uc_addresses_link_delete | Field handler to present a link to delete an address. |