【发布时间】:2023-03-20 19:06:02
【问题描述】:
我正在尝试覆盖 Drupal 7 中的用户配置文件编辑表单,但我不断收到以下错误消息:
注意:未定义索引:template_preprocess_user_profile() 中的#account(/var/www/menit/modules/user/user.pages.inc 的第 189 行)。
注意:未定义索引:rdf_preprocess_user_profile() 中的#account(/var/www/menit/modules/rdf/rdf.module 的第 578 行)。
注意:试图在 user_uri() 中获取非对象的属性(/var/www/menit/modules/user/user.module 的第 190 行)。
注意:尝试在 rdf_preprocess_user_profile() 中获取非对象的属性(/var/www/menit/modules/rdf/rdf.module 的第 603 行)。
注意:试图在 rdf_preprocess_user_profile() 中获取非对象的属性(/var/www/menit/modules/rdf/rdf.module 的第 604 行)。
我所做的是编写一个自定义模块,包含以下代码:
function custom_profile_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
global $user;
if ($user->uid != 1){
$form['#theme'] = 'user_profile';
}
}
function menit_theme($existing, $type, $theme, $path){
return array(
'user_profile' => array(
'render element' => 'form',
'template' => 'templates/user_profile',
),
);
}
并将以下 user_profile.tpl.theme 添加到我的主题模板文件夹中:
<div class="profile"<?php print $attributes; ?>>
<?php print render($user_profile['field_second_name']); ?>
<?php print render($user_profile['field_first_name']);?>
<?php print render($user_profile);?>
</div>
我现在有点迷路了,而且我的时间不多了。有谁知道我在这里做错了什么?
【问题讨论】:
标签: drupal drupal-7 drupal-theming