2011-03-25 22 views
0

我創建了一個帶塊的基本模塊(我喜歡node_import)。現在我希望節點導入也鏈接到(admin/content/myModule)中的設置頁面中,myModule是我創建的模塊。在這之下我想要一個鏈接到node_import。已經閱讀了很多,但沒有找到教程來做到這一點。admin/content/myModule下的菜單結構

+1

那麼,呃,這是什麼問題? – googletorp 2011-03-25 11:47:50

+0

我想要一個菜單​​結構。就像用戶管理中的用戶管理一樣,菜單用戶有2個鏈接(列表,添加用戶)。我不想使用相同的結構,而是使用node_import替換列表和/或添加用戶。 – user001 2011-03-25 12:10:55

回答

0

有幾個方法可以做到這

在mymodule_menu補充一點:


    $items['admin/content/myModule/node_import'] = array(
    'title'    => 'Node Import', // this is the title that appears in the menu 
    'page callback'  => 'drupal_goto', // this is the function that will be called 
    'page arguments'  => array('admin/content/node_import'), // whatever the path is you want Drupal to forward the user to 
    'access arguments'  => array('access content'), // whatever permission you want the user to have to see this menu item 
); 

上述解決方案添加了一個菜單項轉發(HTTP重定向)用戶原來的菜單項。根據我的經驗,這是添加將用戶轉發到其他菜單項的菜單項的最簡單和最安全的方式。

另一種選擇是使用與node_import_menu定義的相同的「頁面回調」和「頁面參數」。您遇到的問題是,有時這些函數將基於頁面路徑上的行爲,因爲頁面路徑會有所不同,並且函數行爲會發生變化。