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/comment/views_handler_field_comment_link.inc
11 11
 * @ingroup views_field_handlers
12 12
 */
13 13
class views_handler_field_comment_link extends views_handler_field_entity {
14
  function construct() {
15
    parent::construct();
16
  }
17 14

  
18
  function option_definition() {
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function option_definition() {
19 19
    $options = parent::option_definition();
20 20
    $options['text'] = array('default' => '', 'translatable' => TRUE);
21 21
    $options['link_to_node'] = array('default' => FALSE, 'bool' => TRUE);
22 22
    return $options;
23 23
  }
24 24

  
25
  function options_form(&$form, &$form_state) {
25
  /**
26
   * {@inheritdoc}
27
   */
28
  public function options_form(&$form, &$form_state) {
26 29
    $form['text'] = array(
27 30
      '#type' => 'textfield',
28 31
      '#title' => t('Text to display'),
......
36 39
    parent::options_form($form, $form_state);
37 40
  }
38 41

  
39
  function query() {
42
  /**
43
   * {@inheritdoc}
44
   */
45
  public function query() {
40 46
    $this->ensure_my_table();
41 47
    $this->add_additional_fields();
42 48
  }
43 49

  
44
  function render($values) {
50
  /**
51
   * {@inheritdoc}
52
   */
53
  public function render($values) {
45 54
    $value = $this->get_value($values, 'cid');
46 55
    return $this->render_link($this->sanitize_value($value), $values);
47 56
  }
48 57

  
49
  function render_link($data, $values) {
58
  /**
59
   * {@inheritdoc}
60
   */
61
  public function render_link($data, $values) {
50 62
    $text = !empty($this->options['text']) ? $this->options['text'] : t('view');
51 63
    $comment = $this->get_value($values);
52 64
    $nid = $comment->nid;
......
60 72
      $this->options['alter']['fragment'] = "comment-" . $cid;
61 73
    }
62 74
    // If there is no comment link to the node.
63
    else if ($this->options['link_to_node']) {
75
    elseif ($this->options['link_to_node']) {
64 76
      $this->options['alter']['path'] = "node/" . $nid;
65 77
    }
66 78

  
67 79
    return $text;
68 80
  }
81

  
69 82
}

Formats disponibles : Unified diff