1 <?php
2
3 /*
4 * This file is part of the Icybee package.
5 *
6 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Icybee;
13
14 /**
15 * Accessor class for the modules of the framework.
16 */
17 class Modules extends \ICanBoogie\Modules
18 {
19 /**
20 * Disables selected modules.
21 *
22 * Modules are disabled againts a list of enabled modules. The enabled modules list is made
23 * from the `enabled_modules` persistant variable and the value of the {@link T_REQUIRED}
24 * tag, which forces some modules to always be enabled.
25 */
26 protected function lazy_get_index()
27 {
28 global $core;
29
30 $index = parent::lazy_get_index();
31 $enableds = $core->vars['enabled_modules'];
32
33 if ($enableds && is_array($enableds))
34 {
35 $enableds = array_flip($enableds);
36
37 foreach ($this->descriptors as $module_id => &$descriptor)
38 {
39 $descriptor[Module::T_DISABLED] = !($descriptor[Module::T_REQUIRED] || isset($enableds[$module_id]));
40 }
41 }
42
43 return $index;
44 }
45 }