Reputation: 55798
I registered successfully a BE module and submodule in Extbase extension with this common code and of course it works:
/** Myext modules group */
Tx_Extbase_Utility_Extension::registerModule($_EXTKEY, 'myext', '', ''
,array(),
array(
'icon' => 'EXT:' . $_EXTKEY .'/ext_icon.gif',
'access' => 'user,group',
'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_myext.xml',
)
);
/** Myext items list mod */
Tx_Extbase_Utility_Extension::registerModule($_EXTKEY, 'myext', 'itemslist','',
array('Item' => 'list',),
array(
'icon' => 'EXT:' . $_EXTKEY . '/Resources/Public/Icons/mod_items.gif',
'access' => 'user,group',
'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_myext_items.xml',
)
);
My problem is that I can't change its ordering in anyway, it always displays at the end of the left column (after Help section). The 4-th param of registerModule
method is position anyway apparently it doesn't affect the main module, only submodules.
So how can I place Myext right after the web
? in such case?
I'm working on TYPO3 ver.: 4.7
Upvotes: 0
Views: 1459
Reputation: 2761
I am sorry, I missunderstood you. You mean your own category that you want to set a specified position.
There is no official way but you can manual reset the order with following code:
// add module before 'File'
if (!isset($TBE_MODULES['yourExtensionCategory'])) {
$temp_TBE_MODULES = array();
foreach($TBE_MODULES as $key => $val) {
if ($key == 'file') {
$temp_TBE_MODULES['yourExtensionCategory'] = '';
$temp_TBE_MODULES[$key] = $val;
} else {
$temp_TBE_MODULES[$key] = $val;
}
}
$TBE_MODULES = $temp_TBE_MODULES;
}
Upvotes: 1
Reputation: 2761
Following code will set the module link to a specified position:
Tx_Extbase_Utility_Extension::registerModule(
$_EXTKEY,
'web', // Make module a submodule of 'web'
'yourmodulem1', // Submodule key
'before:web_ViewpageView', // Position
array(
'Controller' => 'action1, action2'
),
array(
'access' => 'user,group',
'icon' => 'EXT:' . $_EXTKEY . '/Resources/Public/Icons/icon.png',
'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_m1.xml',
)
);
You have set the second argument "mainModuleName" wrong, it is the category, your module belongs to. Valid values are web, files, user, tools, help
. The fourth argument "position" can have following values after:module_id
, before:module_id
or top
. Empty mean bottom
and is default. To get the id of the module, simply inspect the link-element of the menu with your favourite web-developer-tool, the attribute id=
descripes the module_id.
Heres the documentation of registerModule
:
/**
* Registers an Extbase module (main or sub) to the backend interface.
* FOR USE IN ext_tables.php FILES
*
* @param string $extensionName The extension name (in UpperCamelCase) or the extension key (in lower_underscore)
* @param string $mainModuleName The main module key, $sub is the submodule key. So $main would be an index in the $TBE_MODULES array and $sub could be an element in the lists there. If $main is not set a blank $extensionName module is created
* @param string $subModuleName The submodule key. If $sub is not set a blank $main module is created
* @param string $position This can be used to set the position of the $sub module within the list of existing submodules for the main module. $position has this syntax: [cmd]:[submodule-key]. cmd can be "after", "before" or "top" (or blank which is default). If "after"/"before" then submodule will be inserted after/before the existing submodule with [submodule-key] if found. If not found, the bottom of list. If "top" the module is inserted in the top of the submodule list.
* @param array $controllerActions is an array of allowed combinations of controller and action stored in an array (controller name as key and a comma separated list of action names as value, the first controller and its first action is chosen as default)
* @param array $moduleConfiguration The configuration options of the module (icon, locallang.xml file)
* @return void
*/
Please note: if you have templavoila installed, the "page"-Module has not the id "page", it is "web_txtemplavoilaM1", because templavoila replaces the whole page module.
Upvotes: 0