function commerce_wishlist_handler_field_product_link_remove::render in Commerce Wishlist 7.2
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides views_handler_field::render
File
- includes/
views/ handlers/ commerce_wishlist_handler_field_product_link_remove.inc, line 39
Class
- commerce_wishlist_handler_field_product_link_remove
- Field handler to present a link to remove a product for wishlist.
Code
function render($values) {
// Ensure the user has access to remove this product from wishlist.
global $user;
$account = user_load($user->uid);
$wishlist_id = $this
->get_value($values, 'item_id');
$wishlist_owner = $this
->get_value($values, 'uid');
if (commerce_wishlist_manage_access($account, $wishlist_id)) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('Remove');
$destination = drupal_get_destination();
return l($text, 'user/' . $wishlist_owner . '/wishlist/remove/' . $wishlist_id, array(
'query' => $destination,
));
}
return '';
}