1*de19515fSAndreas Gohr<?php 2*de19515fSAndreas Gohrnamespace dokuwiki\Form; 3*de19515fSAndreas Gohr 4*de19515fSAndreas Gohr/** 5*de19515fSAndreas Gohr * Class HTMLElement 6*de19515fSAndreas Gohr * 7*de19515fSAndreas Gohr * Holds arbitrary HTML that is added as is to the Form 8*de19515fSAndreas Gohr * 9*de19515fSAndreas Gohr * @package dokuwiki\Form 10*de19515fSAndreas Gohr */ 11*de19515fSAndreas Gohrclass HTMLElement extends Element { 12*de19515fSAndreas Gohr 13*de19515fSAndreas Gohr /** 14*de19515fSAndreas Gohr * @var string the raw HTML held by this element 15*de19515fSAndreas Gohr */ 16*de19515fSAndreas Gohr protected $html = ''; 17*de19515fSAndreas Gohr 18*de19515fSAndreas Gohr /** 19*de19515fSAndreas Gohr * @param string $html 20*de19515fSAndreas Gohr */ 21*de19515fSAndreas Gohr public function __construct($html) { 22*de19515fSAndreas Gohr parent::__construct('html'); 23*de19515fSAndreas Gohr $this->val($html); 24*de19515fSAndreas Gohr } 25*de19515fSAndreas Gohr 26*de19515fSAndreas Gohr /** 27*de19515fSAndreas Gohr * Get or set the element's content 28*de19515fSAndreas Gohr * 29*de19515fSAndreas Gohr * @param null|string $html 30*de19515fSAndreas Gohr * @return string|$this 31*de19515fSAndreas Gohr */ 32*de19515fSAndreas Gohr public function val($html = null) { 33*de19515fSAndreas Gohr if($html !== null) { 34*de19515fSAndreas Gohr $this->html = $html; 35*de19515fSAndreas Gohr return $this; 36*de19515fSAndreas Gohr } 37*de19515fSAndreas Gohr return $this->html; 38*de19515fSAndreas Gohr } 39*de19515fSAndreas Gohr 40*de19515fSAndreas Gohr /** 41*de19515fSAndreas Gohr * The HTML representation of this element 42*de19515fSAndreas Gohr * 43*de19515fSAndreas Gohr * @return string 44*de19515fSAndreas Gohr */ 45*de19515fSAndreas Gohr public function toHTML() { 46*de19515fSAndreas Gohr return $this->val(); 47*de19515fSAndreas Gohr } 48*de19515fSAndreas Gohr} 49