Skip to content

Commit

Permalink
Merge pull request #13 from markocupic/master
Browse files Browse the repository at this point in the history
Add compatibility to new front end module fragments
  • Loading branch information
saibotd authored Feb 28, 2020
2 parents fe065da + aa77c16 commit 052caa0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Resources/contao/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,19 @@ public function __construct($id)
$this->model = ModuleModel::findByPk($id);
$moduleClass = Module::findClass($this->type);
try {
$module = new $moduleClass($this->model, null);
$strColumn = null;
// Add compatibility to new front end module fragments
if(defined('VERSION'))
{
if (version_compare(VERSION, '4.5', '>='))
{
if ($moduleClass === ModuleProxy::class)
{
$strColumn = 'main';
}
}
}
$module = new $moduleClass($this->model, $strColumn);
$this->compiledHTML = @$module->generate() ?? null;
} catch (\Exception $e) {
$this->compiledHTML = null;
Expand Down

0 comments on commit 052caa0

Please sign in to comment.