From 4ddfaee89b9a0f46bd7ff316e1cbd6157b396fd6 Mon Sep 17 00:00:00 2001 From: Jens Klaer Date: Tue, 21 Jul 2015 10:28:09 +0200 Subject: Fix setting class behavior properties - allow setting class behavior properties for classes deriving from tcomponent only - properties need to be prefixed with 'set' --- framework/Web/UI/TTemplateManager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'framework/Web/UI/TTemplateManager.php') diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 7e1b9c84..05c23fdc 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -938,7 +938,7 @@ class TTemplate extends TApplicationComponent implements ITemplate else { // a simple property - if (! ($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class,$name)) ) + if (! ($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class,'set'.$name)) ) { if ($class->hasMethod('get'.$name) || $class->hasMethod('getjs'.$name)) throw new TConfigurationException('template_property_readonly',$type,$name); @@ -973,7 +973,7 @@ class TTemplate extends TApplicationComponent implements ITemplate else { // id is still alowed for TComponent, even if id property doesn't exist - if(strcasecmp($name,'id')!==0 && !$class->hasMethod('set'.$name)) + if(strcasecmp($name,'id')!==0 && !($class->hasMethod('set'.$name) || $this->isClassBehaviorMethod($class,'set'.$name))) { if($class->hasMethod('get'.$name)) throw new TConfigurationException('template_property_readonly',$type,$name); @@ -1086,7 +1086,7 @@ class TTemplate extends TApplicationComponent implements ITemplate if(!$class->isSubclassOf($name)) continue; foreach($list as $param) { - if(method_exists($param->getBehavior(),'set'.$method)) + if(method_exists($param->getBehavior(),$method)) return true; } } -- cgit v1.2.3