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

$moduleRegistry  : ModuleRegistry

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
getModuleMenuState()  : array<string|int, mixed>
hasAccessibleSubModules()  : bool
Check if a module has at least one accessible submodule at any depth

Properties

Methods

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
bool

getModuleForMenu()

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|null

getModules()

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>
Internal

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
bool

buildMenuModuleRecursively()

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

hasAccessibleSubModules()

Check if a module has at least one accessible submodule at any depth

protected hasAccessibleSubModules(ModuleInterface $module, array<string|int, mixed> $hideModules, BackendUserAuthentication $user, bool $respectWorkspaceRestrictions[, bool $checkRenderInModuleMenu = false ]) : bool
Parameters
$module : ModuleInterface
$hideModules : array<string|int, mixed>
$user : BackendUserAuthentication
$respectWorkspaceRestrictions : bool
$checkRenderInModuleMenu : bool = false
Return values
bool

        
On this page

Search results