Completed
Push — master ( 3b4314...83c2af )
by Sam
12:26
created

HTMLReadonlyField::Field()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 2
c 1
b 1
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * Readonly field equivalent for literal HTML
5
 *
6
 * Unlike HTMLEditorField_Readonly, does not processs shortcodes
7
 */
8
class HTMLReadonlyField extends ReadonlyField {
9
	private static $casting = [
10
		'Value' => 'HTMLFragment',
11
		'ValueEntities' => 'HTMLFragment',
12
	];
13
14
	public function Field($properties = array()) {
15
		return $this->renderWith($this->getTemplates());
16
	}
17
18
	/**
19
	 * Return value with all values encoded in html entities
20
	 *
21
	 * @return string Raw HTML
22
	 */
23
	public function ValueEntities() {
24
		return htmlentities($this->Value(), ENT_COMPAT, 'UTF-8');
25
	}
26
}
27