2013-05-10 59 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替換整個頁面模塊。