TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Backend\Module\ModuleLoader Class Reference
Inheritance diagram for TYPO3\CMS\Backend\Module\ModuleLoader:
t3lib_loadModules

Public Member Functions

 load ($modulesArray, $BE_USER='')
 
 checkExtensionModule ($name)
 
 checkMod ($name, $fullpath)
 
 checkModAccess ($name, $MCONF)
 
 checkModWorkspace ($name, $MCONF)
 
 parseModulesArray ($arr)
 
 cleanName ($str)
 
 getRelativePath ($baseDir, $destDir)
 

Public Attributes

 $modules = array()
 
 $absPathArray = array()
 
 $modListGroup = array()
 
 $modListUser = array()
 
 $BE_USER
 
 $observeWorkspaces = FALSE
 

Protected Member Functions

 getModuleSetupInformation ($moduleName, $pathToModuleDirectory)
 

Protected Attributes

 $navigationComponents = array()
 

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('TYPO3'); $this->loadModules->load($TBE_MODULES);

Author
Kasper Skårhøj kaspe.nosp@m.rYYY.nosp@m.Y@typ.nosp@m.o3.c.nosp@m.om

Definition at line 32 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
Todo:
Define visibility

Definition at line 204 of file ModuleLoader.php.

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
mixed See description of function
Todo:
Define visibility

Definition at line 222 of file ModuleLoader.php.

References $GLOBALS, $MCONF, TYPO3\CMS\Backend\Module\ModuleLoader\checkModAccess(), TYPO3\CMS\Backend\Module\ModuleLoader\checkModWorkspace(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath(), TYPO3\CMS\Backend\Module\ModuleLoader\getModuleSetupInformation(), TYPO3\CMS\Backend\Utility\BackendUtility\getModuleUrl(), TYPO3\CMS\Backend\Module\ModuleLoader\getRelativePath(), 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
boolean TRUE if access is granted for $this->BE_USER
Todo:
Define visibility

Definition at line 406 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
array$MCONFMCONF array (module configuration array) from the modules conf.php file (contains settings about workspace restrictions)
Returns
boolean TRUE if access is granted for $this->BE_USER
Todo:
Define visibility

Definition at line 441 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. Modules must only consist of these characters

Parameters
string$strString to clean up
Returns
string
Todo:
Define visibility

Definition at line 497 of file ModuleLoader.php.

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

◆ 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 358 of file ModuleLoader.php.

References $GLOBALS, $MCONF, $MLANG, and $moduleName.

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.
Todo:
Define visibility

Definition at line 509 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,
  $BE_USER = '' 
)

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)
object$BE_USEROptional backend user object to use. If not set, the global BE_USER object is used.
Returns
void
Todo:
Define visibility

Definition at line 89 of file ModuleLoader.php.

References TYPO3\CMS\Backend\Module\ModuleLoader\$BE_USER, $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 a 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
Todo:
Define visibility

Definition at line 466 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 = array()
Todo:
Define visibility

Definition at line 44 of file ModuleLoader.php.

◆ $BE_USER

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

Definition at line 64 of file ModuleLoader.php.

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

◆ $modListGroup

TYPO3\CMS\Backend\Module\ModuleLoader::$modListGroup = array()
Todo:
Define visibility

Definition at line 50 of file ModuleLoader.php.

◆ $modListUser

TYPO3\CMS\Backend\Module\ModuleLoader::$modListUser = array()
Todo:
Define visibility

Definition at line 56 of file ModuleLoader.php.

◆ $modules

TYPO3\CMS\Backend\Module\ModuleLoader::$modules = array()
Todo:
Define visibility

Definition at line 38 of file ModuleLoader.php.

◆ $navigationComponents

TYPO3\CMS\Backend\Module\ModuleLoader::$navigationComponents = array()
protected

Definition at line 77 of file ModuleLoader.php.

◆ $observeWorkspaces

TYPO3\CMS\Backend\Module\ModuleLoader::$observeWorkspaces = FALSE
Todo:
Define visibility

Definition at line 70 of file ModuleLoader.php.