AbstractFlexibleModule.php
2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* @package AllediaFramework
* @contact www.alledia.com, hello@alledia.com
* @copyright 2016 Alledia.com, All rights reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
namespace Alledia\Framework\Joomla\Extension;
defined('_JEXEC') or die();
use Joomla\Registry\Registry;
use JModuleHelper;
abstract class AbstractFlexibleModule extends Licensed
{
/**
* @var int
*/
public $id = null;
/**
* @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 $name = null;
/**
* @var string
*/
public $style = null;
/**
* @var Registry
*/
public $params = null;
/**
* Class constructor that instantiate the free and pro library, if installed
*
* @param string $namespace Namespace
* @param object $module The base module, instance of stdClass
*/
public function __construct($namespace, $module = null)
{
parent::__construct($namespace, 'module');
$this->loadLibrary();
if (is_object($module)) {
$this->id = $module->id;
$this->title = $module->title;
$this->module = $module->module;
$this->position = $module->position;
$this->content = $module->content;
$this->showtitle = $module->showtitle;
$this->menuid = $module->menuid;
$this->name = $module->name;
$this->style = $module->style;
$this->params = new Registry($module->params);
}
}
/**
* Method to initialize the module
*/
public function init()
{
require JModuleHelper::getLayoutPath('mod_' . $this->element, $this->params->get('layout', 'default'));
}
}