Projet

Général

Profil

Paste
Télécharger (986 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / commerce / modules / customer / includes / views / handlers / commerce_customer_handler_field_customer_profile_link_delete.inc @ b858700c

1
<?php
2

    
3
/**
4
 * Field handler to present a link to delete a customer profile.
5
 */
6
class commerce_customer_handler_field_customer_profile_link_delete extends commerce_customer_handler_field_customer_profile_link {
7
  function construct() {
8
    parent::construct();
9

    
10
    $this->additional_fields['type'] = 'type';
11
    $this->additional_fields['uid'] = 'uid';
12
  }
13

    
14
  function render($values) {
15
    // Ensure the user has access to delete this profile.
16
    $profile = commerce_customer_profile_new();
17
    $profile->profile_id = $this->get_value($values, 'profile_id');
18
    $profile->type = $this->get_value($values, 'type');
19
    $profile->uid = $this->get_value($values, 'uid');
20

    
21
    if (!commerce_customer_profile_access('delete', $profile)) {
22
      return;
23
    }
24

    
25
    $text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
26

    
27
    return l($text, 'admin/commerce/customer-profiles/' . $profile->profile_id . '/delete', array('query' => drupal_get_destination()));
28
  }
29
}