1*64744a10SAndreas Gohr<?php 2*64744a10SAndreas Gohr 3*64744a10SAndreas Gohrnamespace dokuwiki\Form; 4*64744a10SAndreas Gohr 5*64744a10SAndreas Gohr/** 6*64744a10SAndreas Gohr * Class ValueElement 7*64744a10SAndreas Gohr * 8*64744a10SAndreas Gohr * Just like an Element but it's value is not part of its attributes 9*64744a10SAndreas Gohr * 10*64744a10SAndreas Gohr * What the value is (tag name, content, etc) is defined by the actual implementations 11*64744a10SAndreas Gohr * 12*64744a10SAndreas Gohr * @package dokuwiki\Form 13*64744a10SAndreas Gohr */ 14*64744a10SAndreas Gohrabstract class ValueElement extends Element { 15*64744a10SAndreas Gohr 16*64744a10SAndreas Gohr /** 17*64744a10SAndreas Gohr * @var string holds the element's value 18*64744a10SAndreas Gohr */ 19*64744a10SAndreas Gohr protected $value = ''; 20*64744a10SAndreas Gohr 21*64744a10SAndreas Gohr /** 22*64744a10SAndreas Gohr * @param string $type 23*64744a10SAndreas Gohr * @param array $value 24*64744a10SAndreas Gohr * @param array $attributes 25*64744a10SAndreas Gohr */ 26*64744a10SAndreas Gohr public function __construct($type, $value, $attributes = array()) { 27*64744a10SAndreas Gohr parent::__construct($type, $attributes); 28*64744a10SAndreas Gohr $this->val($value); 29*64744a10SAndreas Gohr } 30*64744a10SAndreas Gohr 31*64744a10SAndreas Gohr /** 32*64744a10SAndreas Gohr * Get or set the element's value 33*64744a10SAndreas Gohr * 34*64744a10SAndreas Gohr * @param null|string $value 35*64744a10SAndreas Gohr * @return string|$this 36*64744a10SAndreas Gohr */ 37*64744a10SAndreas Gohr public function val($value = null) { 38*64744a10SAndreas Gohr if($value !== null) { 39*64744a10SAndreas Gohr $this->value = $value; 40*64744a10SAndreas Gohr return $this; 41*64744a10SAndreas Gohr } 42*64744a10SAndreas Gohr return $this->value; 43*64744a10SAndreas Gohr } 44*64744a10SAndreas Gohr 45*64744a10SAndreas Gohr} 46