2016-06-13 115 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)