source: sipes/modules_contrib/views/modules/statistics/views_handler_field_accesslog_path.inc

stableversion-3.0
Last change on this file was 59029b2, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se actualizo la version del modulo views

  • Propiedad mode establecida a 100644
File size: 1.4 KB
Línea 
1<?php
2/**
3 * Field handler to provide simple renderer that turns a URL into a clickable link.
4 *
5 * @ingroup views_field_handlers
6 */
7class views_handler_field_accesslog_path extends views_handler_field {
8  /**
9   * Override init function to provide generic option to link to node.
10   */
11  function init(&$view, &$options) {
12    parent::init($view, $options);
13    if (!empty($this->options['display_as_link'])) {
14      $this->additional_fields['path'] = 'path';
15    }
16  }
17
18  function option_definition() {
19    $options = parent::option_definition();
20
21    $options['display_as_link'] = array('default' => TRUE);
22
23    return $options;
24  }
25
26  /**
27   * Provide link to the page being visited.
28   */
29  function options_form(&$form, &$form_state) {
30    parent::options_form($form, $form_state);
31    $form['display_as_link'] = array(
32      '#title' => t('Display as link'),
33      '#type' => 'checkbox',
34      '#default_value' => !empty($this->options['display_as_link']),
35    );
36  }
37
38  function render($values) {
39    $value = $this->get_value($values);
40    return $this->render_link($this->sanitize_value($value), $values);
41  }
42
43  function render_link($data, $values) {
44    if (!empty($this->options['display_as_link'])) {
45      $this->options['alter']['make_link'] = TRUE;
46      $this->options['alter']['path'] = $this->get_value($values, 'path');
47      $this->options['alter']['html'] = TRUE;
48    }
49
50    return $data;
51  }
52}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.