ModuleProvider
This is the central point to retrieve modules from the ModuleRegistry, while performing the necessary access checks, which ModuleRegistry does not deal with.
Table of Contents
Properties
Methods
- __construct() : mixed
 - accessGranted() : bool
 - Check access of a module for a given user
 - getFirstAccessibleModule() : ModuleInterface|null
 - Returns the first module, accessible for the given user.
 - getModule() : ModuleInterface|null
 - Returns a Module for the given identifier. In case a user is given, also access checks are performed.
 - getModuleForMenu() : MenuModule|null
 - Return the requested (main) module if exist and allowed, prepared for menu generation or similar structured output (nested). Takes TSConfig into account. Does not respect "appearance[renderInModuleMenu]".
 - getModules() : array<string|int, ModuleInterface>
 - Returns all modules either grouped by main modules or flat.
 - getModulesForModuleMenu() : array<string|int, MenuModule>
 - Returns all allowed modules for the current user, prepared for module menu generation or similar structured output (nested).
 - getUserModules() : array<string|int, ModuleInterface>
 - Get all modules with access=user, to be selected in the user/group records
 - isModuleRegistered() : bool
 - Simple wrapper for the registry, which just checks if a module is registered. Does NOT perform any access checks.
 - buildMenuModuleRecursively() : void
 - Recursively builds menu module structure, checking access, TSConfig hideModules, and optionally renderInModuleMenu appearance setting at all nesting levels
 - checkModuleAccess() : bool
 - Check if user has access to module based on the identifier or an alias for the identifier
 - filterInaccessibleSubModules() : void
 - Recursively removes inaccessible submodules from a module at any depth
 
Properties
$moduleRegistry read-only
        protected
            ModuleRegistry
    $moduleRegistry
    
    
    
    
    
    
Methods
__construct()
    public
                    __construct(ModuleRegistry $moduleRegistry) : mixed
    Parameters
- $moduleRegistry : ModuleRegistry
 
accessGranted()
Check access of a module for a given user
    public
                    accessGranted(string $identifier, BackendUserAuthentication $user[, bool $respectWorkspaceRestrictions = true ]) : bool
    Parameters
- $identifier : string
 - $user : BackendUserAuthentication
 - $respectWorkspaceRestrictions : bool = true
 
Return values
boolgetFirstAccessibleModule()
Returns the first module, accessible for the given user.
    public
                    getFirstAccessibleModule(BackendUserAuthentication $user) : ModuleInterface|null
    This will only return submodules or standalone modules.
Parameters
- $user : BackendUserAuthentication
 
not part of TYPO3's API. Only for use in TYPO3 Core.
Return values
ModuleInterface|nullgetModule()
Returns a Module for the given identifier. In case a user is given, also access checks are performed.
    public
                    getModule(string $identifier[, BackendUserAuthentication|null $user = null ][, bool $respectWorkspaceRestrictions = true ]) : ModuleInterface|null
    Parameters
- $identifier : string
 - $user : BackendUserAuthentication|null = null
 - $respectWorkspaceRestrictions : bool = true
 
Return values
ModuleInterface|nullgetModuleForMenu()
Return the requested (main) module if exist and allowed, prepared for menu generation or similar structured output (nested). Takes TSConfig into account. Does not respect "appearance[renderInModuleMenu]".
    public
                    getModuleForMenu(string $identifier, BackendUserAuthentication $user[, bool $respectWorkspaceRestrictions = true ]) : MenuModule|null
    Parameters
- $identifier : string
 - $user : BackendUserAuthentication
 - $respectWorkspaceRestrictions : bool = true
 
Return values
MenuModule|nullgetModules()
Returns all modules either grouped by main modules or flat.
    public
                    getModules([BackendUserAuthentication|null $user = null ][, bool $respectWorkspaceRestrictions = true ][, bool $grouped = true ]) : array<string|int, ModuleInterface>
    In case a user is given, also access checks are performed.
Parameters
- $user : BackendUserAuthentication|null = null
 - $respectWorkspaceRestrictions : bool = true
 - $grouped : bool = true
 
Return values
array<string|int, ModuleInterface>getModulesForModuleMenu()
Returns all allowed modules for the current user, prepared for module menu generation or similar structured output (nested).
    public
                    getModulesForModuleMenu(BackendUserAuthentication $user[, bool $respectWorkspaceRestrictions = true ]) : array<string|int, MenuModule>
    Takes TSConfig and "appearance[renderInModuleMenu]" into account.
Parameters
- $user : BackendUserAuthentication
 - $respectWorkspaceRestrictions : bool = true
 
Return values
array<string|int, MenuModule>getUserModules()
Get all modules with access=user, to be selected in the user/group records
    public
                    getUserModules() : array<string|int, ModuleInterface>
    not part of TYPO3's API. Only for use in TYPO3 Core.
Return values
array<string|int, ModuleInterface>isModuleRegistered()
Simple wrapper for the registry, which just checks if a module is registered. Does NOT perform any access checks.
    public
                    isModuleRegistered(string $identifier) : bool
    Parameters
- $identifier : string
 
Return values
boolbuildMenuModuleRecursively()
Recursively builds menu module structure, checking access, TSConfig hideModules, and optionally renderInModuleMenu appearance setting at all nesting levels
    protected
                    buildMenuModuleRecursively(MenuModule $menuItem, ModuleInterface $module, array<string|int, mixed> $hideModules, BackendUserAuthentication $user, bool $respectWorkspaceRestrictions[, bool $checkRenderInModuleMenu = false ]) : void
    Parameters
- $menuItem : MenuModule
 - $module : ModuleInterface
 - $hideModules : array<string|int, mixed>
 - $user : BackendUserAuthentication
 - $respectWorkspaceRestrictions : bool
 - $checkRenderInModuleMenu : bool = false
 
checkModuleAccess()
Check if user has access to module based on the identifier or an alias for the identifier
    protected
                    checkModuleAccess(BackendUserAuthentication $user, string $identifier) : bool
    Parameters
- $user : BackendUserAuthentication
 - $identifier : string
 
Return values
boolfilterInaccessibleSubModules()
Recursively removes inaccessible submodules from a module at any depth
    protected
                    filterInaccessibleSubModules(ModuleInterface $module, BackendUserAuthentication $user, bool $respectWorkspaceRestrictions) : void
    Parameters
- $module : ModuleInterface
 - $user : BackendUserAuthentication
 - $respectWorkspaceRestrictions : bool