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.inc
11 11
 * @ingroup views_field_handlers
12 12
 */
13 13
class views_handler_field_comment extends views_handler_field {
14

  
14 15
  /**
15 16
   * Override init function to provide generic option to link to comment.
16 17
   */
17
  function init(&$view, &$options) {
18
  public function init(&$view, &$options) {
18 19
    parent::init($view, $options);
19 20
    if (!empty($this->options['link_to_comment'])) {
20 21
      $this->additional_fields['cid'] = 'cid';
......
22 23
    }
23 24
  }
24 25

  
25
  function option_definition() {
26
  /**
27
   * {@inheritdoc}
28
   */
29
  public function option_definition() {
26 30
    $options = parent::option_definition();
27 31
    $options['link_to_comment'] = array('default' => TRUE, 'bool' => TRUE);
28 32
    $options['link_to_node'] = array('default' => FALSE, 'bool' => TRUE);
......
31 35
  }
32 36

  
33 37
  /**
34
   * Provide link-to-comment option
38
   * Provide link-to-comment option.
35 39
   */
36
  function options_form(&$form, &$form_state) {
40
  public function options_form(&$form, &$form_state) {
37 41
    $form['link_to_comment'] = array(
38 42
      '#title' => t('Link this field to its comment'),
39 43
      '#description' => t("Enable to override this field's links."),
......
48 52
    parent::options_form($form, $form_state);
49 53
  }
50 54

  
51
  function render_link($data, $values) {
55
  /**
56
   * {@inheritdoc}
57
   */
58
  public function render_link($data, $values) {
52 59
    if (!empty($this->options['link_to_comment'])) {
53 60
      $this->options['alter']['make_link'] = TRUE;
54 61
      $nid = $this->get_value($values, 'nid');
......
58 65
        $this->options['alter']['fragment'] = "comment-" . $cid;
59 66
      }
60 67
      // If there is no comment link to the node.
61
      else if ($this->options['link_to_node']) {
68
      elseif ($this->options['link_to_node']) {
62 69
        $this->options['alter']['path'] = "node/" . $nid;
63 70
      }
64 71
    }
......
66 73
    return $data;
67 74
  }
68 75

  
69
  function render($values) {
76
  /**
77
   * {@inheritdoc}
78
   */
79
  public function render($values) {
70 80
    $value = $this->get_value($values);
71 81
    return $this->render_link($this->sanitize_value($value), $values);
72 82
  }
83

  
73 84
}

Formats disponibles : Unified diff