【问题标题】:How to display one of Drupal's default forms如何显示 Drupal 的默认表单之一
【发布时间】:2011-06-06 02:41:44
【问题描述】:

我有一个模块,我想用它来显示 Drupal 7 的默认表单之一的修改版本。我相信表单 ID 是 user_profile_form,它是用于编辑用户帐户信息的表单。

这就是我的模块的结构:

  1. 带有页面回调函数的hook_menu --> user_exe_edit() -->
  2. 函数user_exe_edit()调用drupal_get_form(input_simple_form) -->
  3. 函数input_simple_form($form, &$form_submit)

现在我需要函数 input_simple_form 来返回 ID 为 user_profile_form 的 Drupal 表单。

我该怎么做?

【问题讨论】:

  • 嗨查理!你真的应该在drupal.stackexchange.com 中发布drupal 问题,你可能会在那里得到更多答案。

标签: drupal drupal-modules drupal-7 drupal-theming


【解决方案1】:

您不需要 input_simple_form(),但需要包含用户模块的页面:

global $user;
// if the user is logged in, otherwise anonymous users will see it
if ($user->uid > 0) {
   module_load_include('inc', 'user', 'user.pages');
   return user_edit($user);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-15
    相关资源
    最近更新 更多