Problem with multiple admin modules with same model
3 views
Skip to first unread message
Michal Filip
unread,
Feb 21, 2012, 1:01:15 PM2/21/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to diem-users
Today I've run into a problem when creating second admin module for
same model. While the first one had "page" functionality, the second
one did not (otherwise second tree of front pages was created). After
tweaking the admin as necessary I realized that the front application
suddenly wasn't able to create links via helper _link($record),
throwing an exception that the associated module has no page.
Dirty workaround for dmModuleManager is following:
<code>[code]
public function getModuleByModel($model)
{
/*
* do NOT camelize the model
*/
if (isset($this->modelModules[$model]))
{
$module = $this->getModule($this->modelModules[$model]);
if(!$module->hasPage())
foreach($this->getModules() as $altModule)
if($altModule->hasPage() && $altModule->getModel() ==
$model)
return $this->modelModules[$model] = $altModule;
return $module;
}
return null;
}
[/code]</code>
Any ideas are welcome, otherwise hope this helps someone tackling the
same issue...