我一直在使用本指南开发 Drupal 7 模块。
我希望这个模块简单地将它们显示给管理员,然后管理员可以从那里更改和接受它们。我可以让我的模块出现在模块部分,但是当我启用它时,我构建的表单和菜单项不在它们应该在的位置。配置部分没有菜单项,因此我无法导航到我制作的表单。这是我的.module:
/**
* Implements hook_help.
*
* Displays help and module information.
*
* @param path
* Which path of the site we're using to display help
* @param arg
* Array that holds the current path as returned from arg() function
*/
function moderate_submissions_help($path, $arg) {
switch ($path) {
case "admin/help#moderate_submissions":
return '<p>' . "Allows admins to moderate new pending submissions." . '</p>';
break;
}
}
/**
* Implements hook_menu().
*/
function moderate_submissions_menu() {
$items = array();
$items['admin/config/content/moderate_submissions'] = array(
'title' => 'Moderate Submissions',
'description' => 'Go through submissions.',
'page callback' => 'drupal_get_form',
'access arguments' => array('access administration pages'),
'type' => MENU_NORMAL_ITEM,
);
}
/**
* Page callback: Settings
*
* @see moderate_submissions_menu()
*/
function moderate_submissions_form($form, &$form_state) {
$form['moderate_submissions_max'] = array(
'#type' => 'textfield',
'#title' => t('Maximum number of posts'),
'#size' => 2,
'#maxlength' => 2,
'#description' => t('The maximum number of links to display in the block.'),
'#required' => TRUE,
);
return system_settings_form($form);
}
还有我的 .info:
name = Moderate Submissions
description = Moderate pending goal submissions.
core = 7.x
configure = admin/config/content/moderate_submissions
这可能是我在尝试使教程适应我正在构建的内容时忽略的结果。