2016-06-13 43 views
0

我想了解模塊和鉤子菜單。 我遵循本教程。 https://www.youtube.com/watch?v=bjxML7A19ZsDrupal鉤子菜單 - textfield不顯示

「我的你好」頁面鏈接起作用並帶我到正確的頁面(http://localhost:8012/Adrupal/content/weee)。我的問題是,文本字段和標題(輸入你的名字)不顯示。我正在使用Drupal 7.我沒有爲本教程下載任何額外的模塊。

我總是在每次更改後刷新緩存。

文件網址:所有/模塊/你好/ hello.module

function hello_menu(){ 
$items=array(); 
$items['content/weee']=array(
    'title'=>'My Hello Page', 
    'description'=>'My Hello users', 
    'page callback'=>'drupal_get_form', 
    'page arguments'=>array('hello_showHelloForm'), 
    'access callback'=>'user_access', 
    'access arguments'=>array('access content'), 
    'type'=>MENU_NORMAL_ITEM 
); 
return $items; 

}

function hello_showHelloForm($form, &$form_state, $argument){ 
$form=array(); 
$form['name']=array(
'#type'=>'textfield', 
'#title'=>'Enter your name' 
); 

return $form; 

}

我不知道我做錯了什麼。任何幫助將被佔用。

回答

0

回調函數沒有參數提供

function hello_showHelloForm($form, &$form_state, $argument) {} 
+0

我加你改變我的代碼。不幸的是,它沒有奏效。 – Kong

+0

你能不能發佈你的更新代碼片段 –

+0

你好,我更新了代碼。 – Kong

0

如果你有$表前,把「&」這可能發生:

func_name(&$form, &$form_state)