addtodelegate suggestion
hi!
i'm new to this community and also to vanilla.
but in the past 2 weeks i read many lines of code in vanilla and extensions.
the framework and the forum are both realy great.
but i also have a new suggestion:
the predefinedattributes extension is implemented in one class.
to add new delegate's the auther made many small functions like this:
function PredefinedAttributes_AddToApplicationForm($ApplyForm) {
$pa = new PredefinedAttributes($ApplyForm->Context, $ApplyForm->Applicant);
$pa->AddToApplicationForm();
}
$Context->AddToDelegate('ApplyForm', 'PostInputsRender', 'PredefinedAttributes_AddToApplicationForm');
wouldn it be easier to just make a:
$pa = new PredefinedAttributes();
and then
$Context->AddToDelegate('ApplyForm', 'somedelegate', Array(&$pa, 'functionname1'));
$Context->AddToDelegate('ApplyForm', 'somedelegate', Array(&$pa, 'functionname2'));
//and so on...
the change is done in the Framework.Class.Delegation.php file:
on line 36 i just destinguish between string or array
if (is_string($this->Delegates[$DelegateName][$i]))
$this->Delegates[$DelegateName][$i]($this);
else
if (is_array($this->Delegates[$DelegateName][$i]))
call_user_func($this->Delegates[$DelegateName][$i], $this);
else
fatal error
any more ideas? :)
regards, J.
0
This discussion has been closed.