/[drupal]/contributions/modules/views/handlers/views_handler_field_markup.inc
ViewVC logotype

Contents of /contributions/modules/views/handlers/views_handler_field_markup.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Thu Jan 8 20:01:00 2009 UTC (10 months, 2 weeks ago) by merlinofchaos
Branch: MAIN
CVS Tags: DRUPAL-6--2-7, DRUPAL-6--2-6, DRUPAL-6--2-5, DRUPAL-6--2-4, DRUPAL-6--2-3, DRUPAL-6--3-0-ALPHA1, HEAD
Branch point for: DRUPAL-6--2, DRUPAL-6--3, DRUPAL-7--3
Changes since 1.2: +2 -2 lines
File MIME type: text/x-php
#321332 with help from brahms: views_handler_field_markup only worked if format was named "format".
1 <?php
2 // $Id: views_handler_field_markup.inc,v 1.2 2008/09/24 22:48:20 merlinofchaos Exp $
3
4 /**
5 * A handler to run a field through check_markup, using a companion
6 * format field.
7 *
8 * - format: (REQUIRED) The field in this table used to control the format
9 * such as the 'format' field in the node, which goes with the
10 * 'body' field.
11 *
12 * @ingroup views_field_handlers
13 */
14 class views_handler_field_markup extends views_handler_field {
15 /**
16 * Constructor; calls to base object constructor.
17 */
18 function construct() {
19 parent::construct();
20
21 $this->format = $this->definition['format'];
22
23 $this->additional_fields = array();
24 if (!is_numeric($this->format)) {
25 $this->additional_fields['format'] = array('field' => $this->format);
26 }
27 }
28
29 function render($values) {
30 $value = $values->{$this->field_alias};
31 $format = is_numeric($this->format) ? $this->format : $values->{$this->aliases['format']};
32 return check_markup($value, $format, FALSE);
33 }
34
35 function element_type() {
36 if (isset($this->definition['element type'])) {
37 return $this->definition['element type'];
38 }
39
40 return 'div';
41 }
42 }

  ViewVC Help
Powered by ViewVC 1.1.2