自定义Drupal 7模块未出现在Configuration中

时间:2013-02-17 18:32:02

标签: php drupal

我一直在使用this指南来开发Drupal 7模块。

我希望这个模块只是简单地显示给管理员,然后管理员可以从那里更改并接受它们。我可以让我的模块出现在Modules部分,但是当我启用它时,我构建的表单和菜单项不是它们应该的位置。 “配置”部分中没有菜单项,因此无法导航到我制作的表单。这是我的.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

这可能是我在尝试使教程适应我正在构建的内容时忽略的结果。

1 个答案:

答案 0 :(得分:2)

moderate_submisisons_menu()需要返回$items