vendor/contao/core-bundle/src/Resources/contao/library/Contao/ModuleLoader.php line 51

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Contao.
  4.  *
  5.  * (c) Leo Feyer
  6.  *
  7.  * @license LGPL-3.0-or-later
  8.  */
  9. namespace Contao;
  10. /**
  11.  * Loads modules based on their autoload.ini configuration
  12.  *
  13.  * The class reads the autoload.ini files of the available modules and returns
  14.  * an array of active modules with their dependencies solved.
  15.  *
  16.  * Usage:
  17.  *
  18.  *     $arrModules = ModuleLoader::getActive();
  19.  *     $arrModules = ModuleLoader::getDisabled();
  20.  *
  21.  * @deprecated Deprecated since Contao 4.0, to be removed in Contao 5.0.
  22.  *             Use the container parameter "kernel.bundles" instead.
  23.  */
  24. class ModuleLoader
  25. {
  26.     /**
  27.      * Old module names
  28.      * @var array
  29.      */
  30.     private static $legacy = array
  31.     (
  32.         'ContaoCoreBundle'       => 'core',
  33.         'ContaoCalendarBundle'   => 'calendar',
  34.         'ContaoCommentsBundle'   => 'comments',
  35.         'ContaoFaqBundle'        => 'faq',
  36.         'ContaoListingBundle'    => 'listing',
  37.         'ContaoNewsBundle'       => 'news',
  38.         'ContaoNewsletterBundle' => 'newsletter'
  39.     );
  40.     /**
  41.      * Return the active modules as array
  42.      *
  43.      * @return array An array of active modules
  44.      *
  45.      * @deprecated Deprecated since Contao 4.0, to be removed in Contao 5.
  46.      */
  47.     public static function getActive()
  48.     {
  49.         trigger_deprecation('contao/core-bundle''4.0''Using "Contao\ModuleLoader::getActive()" has been deprecated and will no longer work in Contao 5.0.');
  50.         $bundles array_keys(System::getContainer()->getParameter('kernel.bundles'));
  51.         foreach (static::$legacy as $bundleName => $module)
  52.         {
  53.             if (\in_array($bundleName$bundles))
  54.             {
  55.                 $bundles[] = $module;
  56.             }
  57.         }
  58.         return $bundles;
  59.     }
  60.     /**
  61.      * Return the disabled modules as array
  62.      *
  63.      * @return array An array of disabled modules
  64.      *
  65.      * @deprecated Deprecated since Contao 4.0, to be removed in Contao 5.
  66.      */
  67.     public static function getDisabled()
  68.     {
  69.         trigger_deprecation('contao/core-bundle''4.0''Using "Contao\ModuleLoader::getDisabled()" has been deprecated and will no longer work in Contao 5.0.');
  70.         return array();
  71.     }
  72. }
  73. class_alias(ModuleLoader::class, 'ModuleLoader');