【发布时间】:2014-05-02 11:11:43
【问题描述】:
我创建了一个自定义 Drupal7 表单模块,但我只想向经过身份验证的用户显示该表单。我想同样创建模块,它可以在people->permission 部分中有复选框选项,我可以在其中为所有类型的用户设置此模块的权限。这是menu_hook
function form_example_menu() {
$items = array();
$items['examples/form-example'] = array( //this creates a URL that will call this form at "examples/form-example"
'title' => 'Example Form', //page title
'description' => 'A form to mess around with.',
'page callback' => 'drupal_get_form', //this is the function that will be called when the page is accessed. for a form, use drupal_get_form
'page arguments' => array('form_example_form'), //put the name of the form here
'access arguments' => array('access administration pages'),
'access callback' => TRUE
);
return $items;
}
我是 drupal 的新手,所以任何有关这方面的帮助都会很明显。如果有人可以写下 hook_permission 而不是给出示例,那将是一个很大的帮助。
【问题讨论】:
-
这个应该被移到 Drupal stackexchange
标签: drupal drupal-7 drupal-modules