TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Backend\Module\ModuleLoader Class Reference

Public Member Functions

 load ($modulesArray, BackendUserAuthentication $beUser=null)
 
 checkExtensionModule ($name)
 
 checkMod ($name, $fullPath)
 
 checkModAccess ($name, $MCONF)
 
 checkModWorkspace ($name, $MCONF)
 
 parseModulesArray ($arr)
 
 cleanName ($str)
 
 getRelativePath ($baseDir, $destDir)
 

Public Attributes

 $modules = []
 
 $absPathArray = []
 
 $modListGroup = []
 
 $modListUser = []
 
 $BE_USER
 
 $observeWorkspaces = false
 

Protected Member Functions

 getModuleSetupInformation ($moduleName, $pathToModuleDirectory)
 
 getLanguageService ()
 

Protected Attributes

 $navigationComponents = []
 

Detailed Description

This document provides a class that loads the modules for the TYPO3 interface.

Load Backend Interface modules

Typically instantiated like this: $this->loadModules = GeneralUtility::makeInstance(::class); $this->loadModules->load($TBE_MODULES);

Definition at line 34 of file ModuleLoader.php.

Member Function Documentation

◆ checkExtensionModule()

TYPO3\CMS\Backend\Module\ModuleLoader::checkExtensionModule (   $name)

If the module name ($name) is a module from an extension (has path in $this->absPathArray) then that path is returned relative to PATH_site

Parameters
string$nameModule name
Returns
string If found, the relative path from PATH_site

Definition at line 208 of file ModuleLoader.php.

References TYPO3\CMS\Core\Utility\PathUtility\stripPathSitePrefix().

Referenced by TYPO3\CMS\Backend\Module\ModuleLoader\load().

◆ checkMod()

TYPO3\CMS\Backend\Module\ModuleLoader::checkMod (   $name,
  $fullPath 
)

Here we check for the module.

Return values: 'notFound': If the module was not found in the path (no "conf.php" file) FALSE: If no access to the module (access check failed) array(): Configuration array, in case a valid module where access IS granted exists.

Parameters
string$nameModule name
string$fullPathAbsolute path to module
Returns
string|bool|array See description of function

Definition at line 228 of file ModuleLoader.php.

References $GLOBALS, $MCONF, TYPO3\CMS\Backend\Module\ModuleLoader\checkModAccess(), TYPO3\CMS\Backend\Module\ModuleLoader\checkModWorkspace(), TYPO3\CMS\Core\Utility\GeneralUtility\deprecationLog(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath(), TYPO3\CMS\Backend\Module\ModuleLoader\getLanguageService(), TYPO3\CMS\Backend\Module\ModuleLoader\getModuleSetupInformation(), TYPO3\CMS\Backend\Module\ModuleLoader\getRelativePath(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isLoaded(), and TYPO3\CMS\Core\Utility\GeneralUtility\resolveBackPath().

Referenced by TYPO3\CMS\Backend\Module\ModuleLoader\load().

◆ checkModAccess()

TYPO3\CMS\Backend\Module\ModuleLoader::checkModAccess (   $name,
  $MCONF 
)

Returns TRUE if the internal BE_USER has access to the module $name with $MCONF (based on security level set for that module)

Parameters
string$nameModule name
array$MCONFMCONF array (module configuration array) from the modules conf.php file (contains settings about what access level the module has)
Returns
bool TRUE if access is granted for $this->BE_USER

Definition at line 433 of file ModuleLoader.php.

References $MCONF.

Referenced by TYPO3\CMS\Backend\Module\ModuleLoader\checkMod().

◆ checkModWorkspace()

TYPO3\CMS\Backend\Module\ModuleLoader::checkModWorkspace (   $name,
  $MCONF 
)

Check if a module is allowed inside the current workspace for be user Processing happens only if $this->observeWorkspaces is TRUE

Parameters
string$nameModule name (unused)
array$MCONFMCONF array (module configuration array) from the modules conf.php file (contains settings about workspace restrictions)
Returns
bool TRUE if access is granted for $this->BE_USER

Definition at line 466 of file ModuleLoader.php.

References $MCONF, and TYPO3\CMS\Core\Utility\GeneralUtility\inList().

Referenced by TYPO3\CMS\Backend\Module\ModuleLoader\checkMod().

◆ cleanName()

TYPO3\CMS\Backend\Module\ModuleLoader::cleanName (   $str)

The $str is cleaned so that it contains alphanumerical characters only. Module names must only consist of these characters

Parameters
string$strString to clean up
Returns
string

Definition at line 521 of file ModuleLoader.php.

Referenced by TYPO3\CMS\Backend\Module\ModuleLoader\parseModulesArray().

◆ getLanguageService()

TYPO3\CMS\Backend\Module\ModuleLoader::getLanguageService ( )
protected
Returns
LanguageService

Definition at line 562 of file ModuleLoader.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Backend\Module\ModuleLoader\checkMod().

◆ getModuleSetupInformation()

TYPO3\CMS\Backend\Module\ModuleLoader::getModuleSetupInformation (   $moduleName,
  $pathToModuleDirectory 
)
protected

fetches the conf.php file of a certain module, and also merges that with some additional configuration

Parameters
\string$moduleNamethe combined name of the module, can be "web", "web_info", or "tools_log"
\string$pathToModuleDirectorythe path where the module data is put, used for the conf.php or the modScript
Returns
array an array with subarrays, named "configuration" (aka $MCONF), "labels" (previously known as $MLANG) and the stripped path

Definition at line 371 of file ModuleLoader.php.

References $GLOBALS, and $MCONF.

Referenced by TYPO3\CMS\Backend\Module\ModuleLoader\checkMod().

◆ getRelativePath()

TYPO3\CMS\Backend\Module\ModuleLoader::getRelativePath (   $baseDir,
  $destDir 
)

Get relative path for $destDir compared to $baseDir

Parameters
string$baseDirBase directory
string$destDirDestination directory
Returns
string The relative path of destination compared to base.

Definition at line 533 of file ModuleLoader.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\resolveBackPath().

Referenced by TYPO3\CMS\Backend\Module\ModuleLoader\checkMod().

◆ load()

TYPO3\CMS\Backend\Module\ModuleLoader::load (   $modulesArray,
BackendUserAuthentication  $beUser = null 
)

Init. The outcome of the load() function will be a $this->modules array populated with the backend module structure available to the BE_USER Further the global var $LANG will have labels and images for the modules loaded in an internal array.

Parameters
array$modulesArrayShould be the global var $TBE_MODULES, $BE_USER can optionally be set to an alternative Backend user object than the global var $BE_USER (which is the currently logged in user)
BackendUserAuthentication$beUserOptional backend user object to use. If not set, the global BE_USER object is used.
Returns
void

Definition at line 94 of file ModuleLoader.php.

References $GLOBALS, TYPO3\CMS\Backend\Module\ModuleLoader\checkExtensionModule(), TYPO3\CMS\Backend\Module\ModuleLoader\checkMod(), and TYPO3\CMS\Backend\Module\ModuleLoader\parseModulesArray().

◆ parseModulesArray()

TYPO3\CMS\Backend\Module\ModuleLoader::parseModulesArray (   $arr)

Parses the moduleArray ($TBE_MODULES) into an internally useful structure. Returns an array where the keys are names of the module and the values may be TRUE (only module) or an array (of submodules)

Parameters
array$arrModuleArray ($TBE_MODULES)
Returns
array Output structure with available modules

Definition at line 489 of file ModuleLoader.php.

References TYPO3\CMS\Backend\Module\ModuleLoader\cleanName(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Backend\Module\ModuleLoader\load().

Member Data Documentation

◆ $absPathArray

TYPO3\CMS\Backend\Module\ModuleLoader::$absPathArray = []

Definition at line 48 of file ModuleLoader.php.

◆ $BE_USER

TYPO3\CMS\Backend\Module\ModuleLoader::$BE_USER

Definition at line 69 of file ModuleLoader.php.

◆ $modListGroup

TYPO3\CMS\Backend\Module\ModuleLoader::$modListGroup = []

Definition at line 55 of file ModuleLoader.php.

◆ $modListUser

TYPO3\CMS\Backend\Module\ModuleLoader::$modListUser = []

Definition at line 62 of file ModuleLoader.php.

◆ $modules

TYPO3\CMS\Backend\Module\ModuleLoader::$modules = []

Definition at line 41 of file ModuleLoader.php.

◆ $navigationComponents

TYPO3\CMS\Backend\Module\ModuleLoader::$navigationComponents = []
protected

Definition at line 83 of file ModuleLoader.php.

◆ $observeWorkspaces

TYPO3\CMS\Backend\Module\ModuleLoader::$observeWorkspaces = false

Definition at line 76 of file ModuleLoader.php.