以下代码将模块链接设置到指定位置:
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',
)
);
您设置了第二个参数“mainModuleName”错误,它是您的模块所属的类别。有效值为web, files, user, tools, help
。第四个参数“位置”可以有以下值after:module_id
,before:module_id
或top
。空的意思bottom
是默认值。要获取模块的 id,只需使用您最喜欢的 web-developer-tool 检查菜单的链接元素,该属性id=
描述了 module_id。
继承人的文档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
*/
请注意:如果您安装了 templavoila,“page”-Module 没有 id “page”,它是“web_txtemplavoilaM1”,因为 templavoila 替换了整个页面模块。