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/statistics/views_handler_field_accesslog_path.inc
6 6
 */
7 7

  
8 8
/**
9
 * Field handler to provide simple renderer that turns a URL into a clickable link.
9
 * Provide simple renderer that turns a URL into a clickable link.
10 10
 *
11 11
 * @ingroup views_field_handlers
12 12
 */
13 13
class views_handler_field_accesslog_path extends views_handler_field {
14

  
14 15
  /**
15 16
   * Override init function to provide generic option to link to node.
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['display_as_link'])) {
20 21
      $this->additional_fields['path'] = 'path';
21 22
    }
22 23
  }
23 24

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

  
27 31
    $options['display_as_link'] = array('default' => TRUE, 'bool' => TRUE);
......
32 36
  /**
33 37
   * Provide link to the page being visited.
34 38
   */
35
  function options_form(&$form, &$form_state) {
39
  public function options_form(&$form, &$form_state) {
36 40
    $form['display_as_link'] = array(
37 41
      '#title' => t('Display as link'),
38 42
      '#type' => 'checkbox',
......
41 45
    parent::options_form($form, $form_state);
42 46
  }
43 47

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

  
49
  function render_link($data, $values) {
56
  /**
57
   * {@inheritdoc}
58
   */
59
  public function render_link($data, $values) {
50 60
    if (!empty($this->options['display_as_link'])) {
51 61
      $this->options['alter']['make_link'] = TRUE;
52 62
      $this->options['alter']['path'] = $this->get_value($values, 'path');
......
55 65

  
56 66
    return $data;
57 67
  }
68

  
58 69
}

Formats disponibles : Unified diff