2013-05-10 44 views
0

我成功注册Extbase扩展BE模块和子模块与这个共同的代码,当然,它的工作原理:设置TYPO3的顺序模块

/** 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', 
    ) 
); 

我的问题是,我不能改变它的排序中无论如何,它总是显示在左列末尾(在帮助部分)。无论如何,registerModule方法的第4个参数显然不影响主模块,只有子模块。

那么我该如何在web后面放置Myext?在这种情况下?

我的工作TYPO3版本:4.7

回答

1

对不起,我误解了你。你的意思是你想要设置指定位置的你自己的类别。

没有正式的方式,但与下面的代码,你可以手动复位的顺序:

// 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; 
} 
+0

这正是我所做的基础上DAM代码:)无论如何,感谢您进行确认! – biesior 2013-05-10 10:33:06

0

下面的代码模块链接设置为指定的位置:

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_idtop。空的平均值bottom并且是默认值。要获取模块的ID,只需使用您最喜欢的Web开发人员工具检查菜单的链接元素,属性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的“页” - 模块还没有ID为“页”,它是“web_txtemplavoilaM1”,因为templavoila替换整个页面模块。