简体   繁体   English

找不到Drupal表单的页面

[英]Page not found for Drupal form

I have enabled a form under modules but accessing the page gives "page not found" error. 我已经在模块下启用了表单,但是访问页面会出现“找不到页面”错误。

sites/default/modules/awesome_form/awesome_form.module 网站/默认/模块/ awesome_form / awesome_form.module

function awesome_form_menu(){
 $items['my-new-form'] = array(
    'title' => 'simple form',
    'type' => MENU_NORMAL_ITEM,
    'page callback' => 'drupal_get_form',
    'page arguments' => array('show_form_callback'),
    'access arguments' => array('access content'),
    'file' => 'application_file.inc'
  );
  return $items;
}

sites/default/modules/awesome_form/application_file.inc 网站/默认/模块/ awesome_form / application_file.inc

function show_form_callback($form, &$form_state){
  $form['test_input'] = array(
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => 'Name'
  );
  return $form;
}

sites/default/modules/awesome_form/awesome_form.info 网站/默认/模块/ awesome_form / awesome_form.info

name = Awesome Form
description = Some Test Form
core = 7.x

and when I browse to mysite.com/my-new-form I get "page not found" error. 当我浏览到mysite.com/my-new-form时,出现“找不到页面”错误。 I also have enabled the module "Awesome Form" under modules. 我还启用了模块下的“ Awesome Form”模块。 Yet same issue. 同样的问题。

Your module works just tested it on clean install. 您的模块仅在全新安装时对其进行了测试。 The only thing I did which you haven't is to open the php tags in module file and .inc file and that is it. 我唯一没有做的就是在模块文件和.inc文件中打开php标签,就是这样。 Everything works as expected. 一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM