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

  
15 16
  /**
16 17
   * Constructor to provide additional field to add.
17 18
   *
18 19
   * This constructer assumes the taxonomy_term_data table. If using another
19 20
   * table, we'll need to be more specific.
20 21
   */
21
  function construct() {
22
  public function construct() {
22 23
    parent::construct();
23 24
    $this->additional_fields['vid'] = 'vid';
24 25
    $this->additional_fields['tid'] = 'tid';
......
29 30
    );
30 31
  }
31 32

  
32
  function option_definition() {
33
  /**
34
   * {@inheritdoc}
35
   */
36
  public function option_definition() {
33 37
    $options = parent::option_definition();
34 38
    $options['link_to_taxonomy'] = array('default' => FALSE, 'bool' => TRUE);
35 39
    $options['convert_spaces'] = array('default' => FALSE, 'bool' => TRUE);
......
37 41
  }
38 42

  
39 43
  /**
40
   * Provide link to taxonomy option
44
   * Provide link to taxonomy option.
41 45
   */
42
  function options_form(&$form, &$form_state) {
46
  public function options_form(&$form, &$form_state) {
43 47
    $form['link_to_taxonomy'] = array(
44 48
      '#title' => t('Link this field to its taxonomy term page'),
45 49
      '#description' => t("Enable to override this field's links."),
46 50
      '#type' => 'checkbox',
47 51
      '#default_value' => !empty($this->options['link_to_taxonomy']),
48 52
    );
49
     $form['convert_spaces'] = array(
53
    $form['convert_spaces'] = array(
50 54
      '#title' => t('Convert spaces in term names to hyphens'),
51 55
      '#description' => t('This allows links to work with Views taxonomy term arguments.'),
52 56
      '#type' => 'checkbox',
......
60 64
   *
61 65
   * Data should be made XSS safe prior to calling this function.
62 66
   */
63
  function render_link($data, $values) {
67
  public function render_link($data, $values) {
64 68
    $tid = $this->get_value($values, 'tid');
65 69
    if (!empty($this->options['link_to_taxonomy']) && !empty($tid) && $data !== NULL && $data !== '') {
66 70
      $term = new stdClass();
......
87 91
    return $data;
88 92
  }
89 93

  
90
  function render($values) {
94
  /**
95
   * {@inheritdoc}
96
   */
97
  public function render($values) {
91 98
    $value = $this->get_value($values);
92 99
    return $this->render_link($this->sanitize_value($value), $values);
93 100
  }
101

  
94 102
}

Formats disponibles : Unified diff