Backend module configuration¶
Changed in version 12.0
Registration of backend modules was changed with version 12. If you are using an older version of TYPO3 please use the version switcher on the top left of this document to go to the respective version.
The configuration of backend modules is placed in the
dedicated Configuration/Backend/Modules.php
configuration file.
Note
The Configuration/Backend/Modules.php
configuration files are
read and processed when building the container. This
means the state is fixed and cannot be changed at runtime.
Example: register two backend modules¶
You can find the following example in EXT:examples.
Two backend modules are being registered. The first module is based on Extbase while the second uses a plain controller.
<?php
declare(strict_types=1);
use T3docs\Examples\Controller\AdminModuleController;
use T3docs\Examples\Controller\ModuleController;
/**
* Definitions for modules provided by EXT:examples
*/
return [
// Example for a module registration with Extbase controller
'web_examples' => [
'parent' => 'web',
'position' => ['after' => 'web_info'],
'access' => 'user',
'workspaces' => 'live',
'path' => '/module/page/example',
'labels' => 'LLL:EXT:examples/Resources/Private/Language/Module/locallang_mod.xlf',
// Extbase-specific configuration telling the TYPO3 Core to bootstrap Extbase
'extensionName' => 'Examples',
'controllerActions' => [
ModuleController::class => [
'flash', 'tree', 'clipboard', 'links', 'fileReference', 'fileReferenceCreate',
],
],
],
// non-Extbase module registration
'admin_examples' => [
'parent' => 'system',
'position' => ['top'],
'access' => 'user',
'workspaces' => 'live',
'path' => '/module/system/example',
'labels' => 'LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang_mod.xlf',
// non-Extbase modules are route-based, provide them
'routes' => [
'_default' => [
'target' => AdminModuleController::class . '::manage',
],
'edit' => [
'path' => '/edit-me',
'target' => AdminModuleController::class . '::edit',
],
],
],
];
Module configuration options¶
-
parent
¶ -
- Scope
-
Backend module configuration
- type
-
string
If the module should be a submodule, the parent identifier, for example
web
has to be set here. Have a look into the list of available toplevel modules.Extensions can add additional parent modules, see Toplevel modules.
-
path
¶ -
- Scope
-
Backend module configuration
- type
-
string
- Default
-
/module/<mainModule>/<subModule>
Define the path to the default endpoint. The path can be anything, but will fallback to the known
/module/<mainModule>/<subModule>
pattern, if not set.
-
access
¶ -
- Scope
-
Backend module configuration
- type
-
string
Can be
user
(editor permissions),admin
, orsystemMaintainer
.
-
workspaces
¶ -
- Scope
-
Backend module configuration
- type
-
string
Can be
*
(= always),live
oroffline
. If not set, the value of the parent module - if any - is used.
-
position
¶ -
- Scope
-
Backend module configuration
- type
-
array
The module position. Allowed values are
top
andbottom
as well as the key value pairsbefore => <identifier>
andafter => <identifier>
.
-
appearance
¶ -
- Scope
-
Backend module configuration
- type
-
array
Allows to define additional appearance options. Currently only appearance.renderInModuleMenu is available.
-
- Scope
-
Backend module configuration
- type
-
bool
If set to false the module is not displayed in the module menu.
-
iconIdentifier
¶ -
- Scope
-
Backend module configuration
- type
-
string
The module icon identifier
-
icon
¶ -
- Scope
-
Backend module configuration
- type
-
string
Path to a module icon (Deprecated: Use iconIdentifier instead)
-
labels
¶ -
- Scope
-
Backend module configuration
- type
-
array or string
An
array
with the following keys:title
description
shortDescription
The value can either be a static string or a locallang label reference. |
It is also possible to define the path to a locallang file. The referenced file should contain the following label keys:
mlang_tabs_tab
(used as module title)mlang_labels_tabdescr
(used as module description)mlang_labels_tablabel
(used as module short description)
-
component
¶ -
- Scope
-
Backend module configuration
- type
-
string
- Default
-
TYPO3/CMS/Backend/Module/Iframe
The view component, responsible for rendering the module.
-
- Scope
-
Backend module configuration
- type
-
string
The module navigation component. The following are provided by the Core:
@typo3/backend/page-tree/page-tree-element
- The page tree as used in the Web module.
@typo3/backend/tree/file-storage-tree-container
- The file tree as used in the Filelist module.
-
- Scope
-
Backend module configuration
- type
-
string
The module navigation component (Deprecated: Use navigationComponent)
-
- Scope
-
Backend module configuration
- type
-
bool
- Default
-
true
Whether the module should use the parents navigation component. This option defaults to
true
and can therefore be used to stop the inheritance for submodules.
-
moduleData
¶ -
- Scope
-
Backend module configuration
- type
-
array
All properties of the module data object that may be overridden by
GET
/POST
parameters of the request get their default value defined here.Example
<?php declare(strict_types=1); return [ 'my_module' => [ // ... 'moduleData' => [ 'allowedProperty' => '', 'anotherAllowedProperty' => true, ], ], ];
Copied!
-
aliases
¶ -
- Scope
-
Backend module configuration
- type
-
array
List of identifiers that are aliases to this module. Those are added as route aliases, which allows to use them for building links, for example with the
\TYPO3\CMS\Backend\Routing\UriBuilder
. Additionally, the aliases can also be used for references in other modules, for example to specify a module's parent.Examples
Example for a new module identifier:
<?php declare(strict_types=1); return [ 'workspaces_admin' => [ 'parent' => 'web', // ... // choose the previous name or an alternative name 'aliases' => ['web_WorkspacesWorkspaces'], ], ];
Copied!Example for a route alias identifier:
<?php declare(strict_types=1); return [ 'file_editcontent' => [ // ... 'path' => '/file/editcontent', 'aliases' => ['file_edit'], ], ];
Copied!
Default module configuration options (without Extbase)¶
-
routes
¶ -
- Scope
-
Backend module configuration
- type
-
array
Define the routes to this module. Each route requires at least the
target
. The_default
route is mandatory, except for modules which can fall back to a submodule. Thepath
of the_default
route is taken from the top-level configuration. For all other routes, the route identifier is taken aspath
, if not explicitly defined. Each route can define any controller/action pair and can restrict the allowed HTTP methods:<?php declare(strict_types=1); use MyVendor\MyExtension\Classes\Controller\MyModuleController; return [ 'my_module' => [ // ... 'routes' => [ '_default' => [ 'target' => MyModuleController::class . '::overview', ], 'edit' => [ 'path' => '/edit-me', 'target' => MyModuleController::class . '::edit', ], 'manage' => [ 'target' => AnotherController::class . '::manage', 'methods' => ['POST'], ], ], ], ];
Copied!All subroutes are automatically registered in a
\TYPO3\CMS\Core\Routing\RouteCollection
. The full syntax for route identifiers is<module_identifier>.<sub_route>
, for example,my_module.edit
. Therefore, using the\TYPO3\CMS\Backend\Routing\UriBuilder
to create a link to such a sub-route might look like this:\TYPO3\CMS\Backend\Routing\UriBuilder->buildUriFromRoute('my_module.edit');
Copied!
Extbase module configuration options¶
Note
Using these Extbase configurations tells the Core to bootstrap Extbase and expecting
controllers based on \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
.
Do not use it for non-Extbase controller. Use routes
instead.
-
extensionName
¶ -
- Scope
-
Backend module configuration
- type
-
string
The extension name in UpperCamelCase for which the module is registered. If the extension key is
my_example_extension
the extension name would beMyExampleExtension
.
-
controllerActions
¶ -
- Scope
-
Backend module configuration
- type
-
array
Define the controller action pair. The array keys are the controller class names and the values are the actions, which can either be defined as array or comma-separated list:
<?php declare(strict_types=1); use MyVendor\MyExtension\Classes\Controller\MyModuleController; return [ 'web_ExtkeyExample' => [ //... 'path' => '/module/web/ExtkeyExample', 'controllerActions' => [ MyModuleController::class => [ 'list', 'detail', ], ], ], ];
Copied!The modules define explicit routes for each controller/action combination, as long as the
enableNamespacedArgumentsForBackend
feature toggle is turned off (which is the default). This effectively means human-readable URLs, since the controller/action combinations are no longer defined via query parameters, but are now part of the path.This leads to the following URLs:
https://example.com/typo3/module/web/ExtkeyExample
https://example.com/typo3/module/web/ExtkeyExample/MyModuleController/list
https://example.com/typo3/module/web/ExtkeyExample/MyModuleController/detail
The route identifier of corresponding routes is registered with similar syntax as standard backend modules:
<module_identifier>.<controller>_<action>
. Above configuration will therefore register the following routes:web_ExtkeyExample
web_ExtkeyExample.MyModuleController_list
web_ExtkeyExample.MyModuleController_detail
View registered modules¶
All registered modules are stored as objects in a registry. They can be viewed in the backend in the System > Configuration > Backend Modules module.
The ModuleProvider API allows extension authors to work with the registered modules.