Removing translation directories
[project/views.git] / handlers / views_handler_field_markup.inc
CommitLineData
fe44beb7 1<?php
fe44beb7
EM
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)) {
713e4641 24 $this->additional_fields['format'] = array('field' => $this->format);
fe44beb7
EM
25 }
26 }
27
28 function render($values) {
29 $value = $values->{$this->field_alias};
30 $format = is_numeric($this->format) ? $this->format : $values->{$this->aliases['format']};
31 return check_markup($value, $format, FALSE);
32 }
25c44cc1
EM
33
34 function element_type() {
35 if (isset($this->definition['element type'])) {
36 return $this->definition['element type'];
37 }
38
39 return 'div';
40 }
fe44beb7 41}