. */ namespace Alledia\Framework\Joomla\Extension; defined('_JEXEC') or die(); use Joomla\CMS\Helper\ModuleHelper; use Joomla\Registry\Registry; abstract class AbstractFlexibleModule extends Licensed { /** * @var string */ public $title = null; /** * @var */ public $module = null; /** * @var */ public $position = null; /** * @var string */ public $content = null; /** * @var bool */ public $showtitle = null; /** * @var int */ public $menuid = null; /** * @var string */ public $style = null; /** * @inheritDoc */ public function __construct($namespace, $module = null) { parent::__construct($namespace, 'module'); $this->loadLibrary(); if (is_object($module)) { $properties = [ 'id', 'title', 'module', 'position', 'content', 'showtitle', 'menuid', 'name', 'style', 'params' ]; foreach ($properties as $property) { if (isset($module->{$property})) { $this->{$property} = $module->{$property}; } } if (!$this->params instanceof Registry) { $this->params = new Registry($this->params); } } } /** * Method to initialize the module */ public function init() { require ModuleHelper::getLayoutPath('mod_' . $this->element, $this->params->get('layout', 'default')); } }