[英]Drupal: drupal_get_form specify file to search
如何指定文件以搜索功能drupal_get_form?
If you mean a form used as page callback, the file
parameter is where you can specify a filename: 如果您的意思是将表单用作页面回调,则可以在
file
参数中指定文件名:
/**
* Implementation of hook_menu().
*/
function MODULENAME_menu(){
return array(
'my/form' => array(
'page callback' => 'drupal_get_form',
'page arguments' => array('MODULENAME_myform'),
'file' => 'myform.inc',
//
// ...
//
),
);
}
In that example, the function " MODULENAME_myform
" that returns the form structure that drupal_get_form
uses to build the page " www.yoursite.com/my/form
" is stored in the file " myform.inc
". 在该示例中,函数“
MODULENAME_myform
”存储在文件“ myform.inc
”中,该函数返回drupal_get_form
用于构建页面“ www.yoursite.com/my/form
”的表单结构。
use include_once , require_once or require for adding files where the form resides . 使用include_once , require_once或require来添加表单所在的文件。 drupal_get_form automatically takes care to include the form.
drupal_get_form会自动注意包含表单。
for example : 例如 :
include_once drupal_get_path('module', 'modname') .'/file.php';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.