summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TControl.php
diff options
context:
space:
mode:
authorxue <>2007-06-15 15:10:44 +0000
committerxue <>2007-06-15 15:10:44 +0000
commit362a4036eb99b108050bdb027626de964a90ef67 (patch)
treee5b16d577f0d13db64ea8f4b9fca9a45839d9986 /framework/Web/UI/TControl.php
parenta9014dcee56ecbcee2321bddc51b239af2d59d5e (diff)
Fixed #641.
Diffstat (limited to 'framework/Web/UI/TControl.php')
-rw-r--r--framework/Web/UI/TControl.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php
index cd24de41..dcfcec65 100644
--- a/framework/Web/UI/TControl.php
+++ b/framework/Web/UI/TControl.php
@@ -966,19 +966,20 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable
/**
* Finds all child and grand-child controls that are of the specified type.
* @param string the class name
+ * @param boolean whether the type comparison is strict or not. If false, controls of the parent classes of the specified class will also be returned.
* @return array list of controls found
*/
- public function findControlsByType($type)
+ public function findControlsByType($type,$strict=true)
{
$controls=array();
if($this->getHasControls())
{
foreach($this->_rf[self::RF_CONTROLS] as $control)
{
- if(is_object($control) && get_class($control)===$type)
+ if(is_object($control) && (get_class($control)===$type || (!$strict && ($control instanceof $type))))
$controls[]=$control;
if(($control instanceof TControl) && $control->getHasControls())
- $controls=array_merge($controls,$control->findControlsByType($type));
+ $controls=array_merge($controls,$control->findControlsByType($type,$strict));
}
}
return $controls;