ModuleProvider

The ModuleProvider API allows extension authors to work with the registered modules.

This API is the central point to retrieve modules, since it automatically performs necessary access checks and prepares specific structures, for example for the use in menus.

ModuleProvider API

class ModuleProvider
Fully qualified name
\TYPO3\CMS\Backend\Module\ModuleProvider

This is the central point to retrieve modules from the ModuleRegistry, while performing the necessary access checks, which ModuleRegistry does not deal with.

isModuleRegistered ( string $identifier)

Simple wrapper for the registry, which just checks if a module is registered. Does NOT perform any access checks.

param $identifier

the identifier

Returns
bool
getModule ( string $identifier, ?\TYPO3\CMS\Core\Authentication\BackendUserAuthentication $user = NULL, bool $respectWorkspaceRestrictions = true)

Returns a Module for the given identifier. In case a user is given, also access checks are performed.

param $identifier

the identifier

param $user

the user, default: NULL

param $respectWorkspaceRestrictions

the respectWorkspaceRestrictions, default: true

Returns
?\TYPO3\CMS\Backend\Module\ModuleInterface
getModules ( ?\TYPO3\CMS\Core\Authentication\BackendUserAuthentication $user = NULL, bool $respectWorkspaceRestrictions = true, bool $grouped = true)

Returns all modules either grouped by main modules or flat.

In case a user is given, also access checks are performed.

param $user

the user, default: NULL

param $respectWorkspaceRestrictions

the respectWorkspaceRestrictions, default: true

param $grouped

the grouped, default: true

Returns
\ModuleInterface[]
getModuleForMenu ( string $identifier, \TYPO3\CMS\Core\Authentication\BackendUserAuthentication $user, bool $respectWorkspaceRestrictions = true)

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]".

param $identifier

the identifier

param $user

the user

param $respectWorkspaceRestrictions

the respectWorkspaceRestrictions, default: true

Returns
?\TYPO3\CMS\Backend\Module\MenuModule
getModulesForModuleMenu ( \TYPO3\CMS\Core\Authentication\BackendUserAuthentication $user, bool $respectWorkspaceRestrictions = true)

Returns all allowed modules for the current user, prepared for module menu generation or similar structured output (nested).

Takes TSConfig and "appearance[renderInModuleMenu]" into account.

param $user

the user

param $respectWorkspaceRestrictions

the respectWorkspaceRestrictions, default: true

Returns
\MenuModule[]
accessGranted ( string $identifier, \TYPO3\CMS\Core\Authentication\BackendUserAuthentication $user, bool $respectWorkspaceRestrictions = true)

Check access of a module for a given user

param $identifier

the identifier

param $user

the user

param $respectWorkspaceRestrictions

the respectWorkspaceRestrictions, default: true

Returns
bool