我正在使用theme_user_profile_form($form)
并投入生产线
unset ($form['timezone']);
但它不会从页面中删除该项目
我尝试:
theme_preprocess_user_profile_form
但它似乎不起作用。
我要做的就是删除用户配置文件编辑表单的某些部分,例如主题选择、时区等
我正在使用theme_user_profile_form($form)
并投入生产线
unset ($form['timezone']);
但它不会从页面中删除该项目
我尝试:
theme_preprocess_user_profile_form
但它似乎不起作用。
我要做的就是删除用户配置文件编辑表单的某些部分,例如主题选择、时区等
最简单的方法是使用hook_form_alter
. 这需要在自定义模块中,而不是在您的主题中。
最好的事情是你必须做那个钩子表单改变,但是在表单的后续构建中做未设置,即
function example_form_alter(&$form, &$form_state, $form_id) {
$form["#after_build"][] = "example";
}
function example($form, &$form_state) {`
//dpm($form); /*devel module dependency for looking for the correct object*/
//unset
return $form;
}