Projet

Général

Profil

Révision 5d12d676

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/modules/taxonomy/views_handler_field_term_link_edit.inc
11 11
 * @ingroup views_field_handlers
12 12
 */
13 13
class views_handler_field_term_link_edit extends views_handler_field {
14
  function construct() {
14

  
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function construct() {
15 19
    parent::construct();
16 20
    $this->additional_fields['tid'] = 'tid';
17 21
    $this->additional_fields['vid'] = 'vid';
......
21 25
    );
22 26
  }
23 27

  
24
  function option_definition() {
28
  /**
29
   * {@inheritdoc}
30
   */
31
  public function option_definition() {
25 32
    $options = parent::option_definition();
26 33

  
27 34
    $options['text'] = array('default' => '', 'translatable' => TRUE);
......
29 36
    return $options;
30 37
  }
31 38

  
32
  function options_form(&$form, &$form_state) {
39
  /**
40
   * {@inheritdoc}
41
   */
42
  public function options_form(&$form, &$form_state) {
33 43
    $form['text'] = array(
34 44
      '#type' => 'textfield',
35 45
      '#title' => t('Text to display'),
......
38 48
    parent::options_form($form, $form_state);
39 49
  }
40 50

  
41
  function query() {
51
  /**
52
   * {@inheritdoc}
53
   */
54
  public function query() {
42 55
    $this->ensure_my_table();
43 56
    $this->add_additional_fields();
44 57
  }
45 58

  
46
  function render($values) {
59
  /**
60
   * {@inheritdoc}
61
   */
62
  public function render($values) {
47 63
    // Check there is an actual value, as on a relationship there may not be.
48 64
    if ($tid = $this->get_value($values, 'tid')) {
49
      // Mock a term object for taxonomy_term_edit_access(). Use machine name and
50
      // vid to ensure compatibility with vid based and machine name based
65
      // Mock a term object for taxonomy_term_edit_access(). Use machine name
66
      // and vid to ensure compatibility with vid based and machine name based
51 67
      // access checks. See http://drupal.org/node/995156
52 68
      $term = new stdClass();
53 69
      $term->vid = $values->{$this->aliases['vid']};
......
55 71
      if (taxonomy_term_edit_access($term)) {
56 72
        $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
57 73
        $tid = $this->get_value($values, 'tid');
58
        return l($text, 'taxonomy/term/'. $tid . '/edit', array('query' => drupal_get_destination()));
74
        return l($text, 'taxonomy/term/' . $tid . '/edit', array('query' => drupal_get_destination()));
59 75
      }
60 76
    }
61 77
  }
78

  
62 79
}

Formats disponibles : Unified diff