source: sipes/modules_contrib/views/handlers/views_handler_field_markup.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: 1.3 KB
Línea 
1<?php
2
3/**
4 * A handler to run a field through check_markup, using a companion
5 * format field.
6 *
7 * - format: (REQUIRED) The field in this table used to control the format
8 *           such as the 'format' field in the node, which goes with the
9 *           'body' field.
10 *
11 * @ingroup views_field_handlers
12 */
13class views_handler_field_markup extends views_handler_field {
14  /**
15   * Constructor; calls to base object constructor.
16   */
17  function construct() {
18    parent::construct();
19
20    $this->format = $this->definition['format'];
21
22    $this->additional_fields = array();
23    if (!is_numeric($this->format)) {
24      $this->additional_fields['format'] = array('field' => $this->format);
25    }
26  }
27
28  function render($values) {
29    $value = $this->get_value($values);
30    if (!is_numeric($this->format)) {
31      $format = $this->get_value($values, 'format');
32    }
33    else {
34      $format = $this->format;
35    }
36    if ($value) {
37      $value = str_replace('<!--break-->', '', $value);
38      return check_markup($value, $format, FALSE);
39    }
40  }
41
42  function element_type($none_supported = FALSE, $default_empty = FALSE, $inline = FALSE) {
43    if ($inline) {
44      return 'span';
45    }
46
47    if (isset($this->definition['element type'])) {
48      return $this->definition['element type'];
49    }
50
51    return 'div';
52  }
53}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.