diff options
Diffstat (limited to 'lib/prado/framework/Web/UI/WebControls/THtmlElement.php')
-rw-r--r-- | lib/prado/framework/Web/UI/WebControls/THtmlElement.php | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/lib/prado/framework/Web/UI/WebControls/THtmlElement.php b/lib/prado/framework/Web/UI/WebControls/THtmlElement.php new file mode 100644 index 0000000..6efd608 --- /dev/null +++ b/lib/prado/framework/Web/UI/WebControls/THtmlElement.php @@ -0,0 +1,66 @@ +<?php +/** + * THtmlElement class file. + * + * @author Qiang Xue <qiang.xue@gmail.com> + * @link https://github.com/pradosoft/prado + * @copyright Copyright © 2005-2015 The PRADO Group + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT + * @package System.Web.UI.WebControls + */ + +Prado::using('System.Web.UI.WebControls.TWebControl'); + +/** + * THtmlElement class. + * + * THtmlElement represents a generic HTML element whose tag name is specified + * via {@link setTagName TagName} property. Because THtmlElement extends from + * {@link TWebControl}, it enjoys all its functionalities. + * + * To change the default tag your subclass should override {@link getDefaultTagName} + * + * @author Qiang Xue <qiang.xue@gmail.com> + * @author Brad Anderson <javalizard@gmail.com> + * @package System.Web.UI.WebControls + * @since 3.1.2 + */ +class THtmlElement extends TWebControl +{ + /** + * @var the tag of this element + */ + private $_tagName=null; + + /** + * @return string the tag name of this control. Defaults to 'span'. + */ + public function getTagName() + { + return ($this->_tagName !== null) ? $this->_tagName : ($this->_tagName = $this->getDefaultTagName()); + } + + /** + * @param string the tag name of this control. + */ + public function setTagName($value) + { + $this->_tagName=TPropertyValue::ensureString($value); + } + + /** + * This is the default tag when no other is specified + * @return string the default tag + */ + public function getDefaultTagName() { + return 'span'; + } + + /** + * This tells you if this TagName has deviated from the original + * @return boolean true if TagName has deviated from the default. + */ + public function getIsMutated() { + return $this->_tagName !== null && $this->_tagName != $this->getDefaultTagName(); + } +} |