I'd like to integrate a few linked admin functions for a specific site. In specifics, I'll be linking the creation of a FEU Group with a News category, a Comments category, and others; allowing me to link specific content to a FEU group. This will prevent the admins of the site from repetitive entry. Now I could go through each of the modules methods, combine them into a giant one; but that's not really portable when the News or other modules get updated. Instead I'd like to call the other modules from my linking module action; I'm assuming it's something like:
$gCms->modules['News']->addcategory....
If that's correct, how would the parameters be passed syntax wise?
[SOLVED] Calling other modules from a method
[SOLVED] Calling other modules from a method
Last edited by larss on Tue May 19, 2009 5:52 pm, edited 1 time in total.
Re: Calling other modules from a method
Access the module object with:
or:
(and check if it exists and is active before going further)
Then you should be able to access the module's actions with :
So in your case :
$themodule->DoAction("addcategory",$id,$params,$returnid);
$params being an array containing the "name", and eventually "parent" or anything the action might need...
And of course you should use module events to call your "linking module".
Have a nice day,
plger
Code: Select all
$themodule = $this->GetModuleInstance("News")
Code: Select all
$themodule = $gCms->modules['News']['object'];
Then you should be able to access the module's actions with :
Code: Select all
$themodule->DoAction($action, $id, $params, $returnid=-1);
$themodule->DoAction("addcategory",$id,$params,$returnid);
$params being an array containing the "name", and eventually "parent" or anything the action might need...
And of course you should use module events to call your "linking module".
Have a nice day,
plger
Re: Calling other modules from a method
Thanks a ton, this is exactly what I was looking for.
Last edited by larss on Tue May 19, 2009 5:52 pm, edited 1 time in total.
Re: Calling other modules from a method
No problem.
You should mark the topic as [solved]...
You should mark the topic as [solved]...