summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TWebControl.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/WebControls/TWebControl.php')
-rw-r--r--framework/Web/UI/WebControls/TWebControl.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/framework/Web/UI/WebControls/TWebControl.php b/framework/Web/UI/WebControls/TWebControl.php
index 6e2a2c89..e86b9161 100644
--- a/framework/Web/UI/WebControls/TWebControl.php
+++ b/framework/Web/UI/WebControls/TWebControl.php
@@ -40,6 +40,23 @@ Prado::using('System.Web.UI.WebControls.TStyle');
class TWebControl extends TControl
{
/**
+ * Copies basic control attributes from another control.
+ * Properties including AccessKey, ToolTip, TabIndex, Enabled
+ * and Attributes are copied.
+ * @param TWebControl source control
+ */
+ public function copyBaseAttributes(TWebControl $control)
+ {
+ $this->setAccessKey($control->getAccessKey());
+ $this->setToolTip($control->getToolTip());
+ $this->setTabIndex($control->getTabIndex());
+ if(!$control->getEnabled())
+ $this->setEnabled(false);
+ if($control->getHasAttributes())
+ $this->getAttributes()->copyFrom($control->getAttributes());
+ }
+
+ /**
* @return string the access key of the control
*/
public function getAccessKey()