diff options
author | javalizard <> | 2010-04-16 23:19:13 +0000 |
---|---|---|
committer | javalizard <> | 2010-04-16 23:19:13 +0000 |
commit | be9205e46bad671c50048e3f53c72768c8f239bd (patch) | |
tree | e6efe49332b209295f06b29c71b8cb70637340a7 /framework/Web/UI/WebControls | |
parent | 7c161a0b69a48d5185fe3b299af0a390f1d11703 (diff) |
Makes it possible for subclasses to define the default tag by overriding the function getDefaultTag
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r-- | framework/Web/UI/WebControls/THtmlElement.php | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/framework/Web/UI/WebControls/THtmlElement.php b/framework/Web/UI/WebControls/THtmlElement.php index bb33623e..9ae894b1 100644 --- a/framework/Web/UI/WebControls/THtmlElement.php +++ b/framework/Web/UI/WebControls/THtmlElement.php @@ -4,7 +4,7 @@ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -19,20 +19,30 @@ Prado::using('System.Web.UI.WebControls.TWebControl'); * 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 getDefaultTag}
+ *
* @author Qiang Xue <qiang.xue@gmail.com>
+ * @author Brad Anderson <javalizard@gmail.com>
* @version $Id$
* @package System.Web.UI.WebControls
* @since 3.1.2
*/
class THtmlElement extends TWebControl
{
- private $_tagName='span';
+ /**
+ * @var the tag of this element
+ */
+ private $_tagName=null;
/**
* @return string the tag name of this control. Defaults to 'span'.
*/
public function getTagName()
{
+ if($this->_tagName !== null) return $this->_tagName;
+
+ $this->_tagName = $this->getDefaultTag();
+
return $this->_tagName;
}
@@ -43,4 +53,12 @@ class THtmlElement extends TWebControl {
$this->_tagName=$value;
}
-} +
+ /**
+ * This is the default tag when no other is specified
+ * @return string the default tag
+ */
+ protected function getDefaultTag() {
+ return 'span';
+ }
+}
|