You are here

function commerce_customer_handler_field_customer_profile_link_delete::render in Commerce Core 7

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides commerce_customer_handler_field_customer_profile_link::render

File

modules/customer/includes/views/handlers/commerce_customer_handler_field_customer_profile_link_delete.inc, line 14

Class

commerce_customer_handler_field_customer_profile_link_delete
Field handler to present a link to delete a customer profile.

Code

function render($values) {

  // Ensure the user has access to delete this profile.
  $profile = commerce_customer_profile_new();
  $profile->profile_id = $this
    ->get_value($values, 'profile_id');
  $profile->type = $this
    ->get_value($values, 'type');
  $profile->uid = $this
    ->get_value($values, 'uid');
  if (!commerce_customer_profile_access('delete', $profile)) {
    return;
  }
  $text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
  return l($text, 'admin/commerce/customer-profiles/' . $profile->profile_id . '/delete', array(
    'query' => drupal_get_destination(),
  ));
}