source: sipes/modules_contrib/views/handlers/views_handler_field_url.inc @ 65dadeb

stableversion-3.0
Last change on this file since 65dadeb 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: 979 octetos
Línea 
1<?php
2
3/**
4 * Field handler to provide simple renderer that turns a URL into a clickable link.
5 *
6 * @ingroup views_field_handlers
7 */
8class views_handler_field_url extends views_handler_field {
9  function option_definition() {
10    $options = parent::option_definition();
11
12    $options['display_as_link'] = array('default' => TRUE);
13
14    return $options;
15  }
16
17  /**
18   * Provide link to the page being visited.
19   */
20  function options_form(&$form, &$form_state) {
21    parent::options_form($form, $form_state);
22    $form['display_as_link'] = array(
23      '#title' => t('Display as link'),
24      '#type' => 'checkbox',
25      '#default_value' => !empty($this->options['display_as_link']),
26    );
27  }
28
29  function render($values) {
30    $value = $this->get_value($values);
31    if (!empty($this->options['display_as_link'])) {
32      return l($this->sanitize_value($value), $value, array('html' => TRUE));
33    }
34    else {
35      return $this->sanitize_value($value, 'url');
36    }
37  }
38}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.