"Jim Wilson" wilson.jim.r@gmail.com wrote in message news:ac08e8d0702140949u83cc418hd6f54fca61b1ec64@mail.gmail.com...
How do you feel about this alternative? (continuing the UploadForm
example):
function instantiate( &$request ) { $uploadForm = NULL; wfRunHooks('BeforeInstantiate_UploadForm', array( &$uploadForm, &$request )); if ($uploadForm != NULL) { return $uploadForm; } $uploadForm = new UploadForm($request); wfRunHooks('AfterInstantiate_UploadForm', array( &$uploadForm,
&$request
)); return $uploadForm; }
AfterInstantiate_X should be run regardless of where the object came from. The above should probably be (in some kind of pseudo-code form):
function instantiate( &$args) { $objResult = NULL; wfRunHooks('BeforeInstantiate_X', array( &$objResult, &$args));
if ($objResult === NULL) $objResult = new Object($args);
wfRunHooks('AfterInstantiate_X', array( &$ojResult, &$args)); return $objResult; }
- Mark Clements (HappyDog)