3

如何访问用户配置文件表单上字段组内的字段?
在我的自定义模块中,我可以使用下面的代码修改帐户名称和电子邮件。

$form['account']['name']['#description'] = 'Enter a username';
$form['account']['mail']['#description'] = 'Enter a valid email address';

这不适用于修改个人信息字段组内的字段:

$form['Personal information']['profile_name']['#description'] = 'Enter a valid email address';

我试图访问的数组部分如下。

[Personal information] => Array
    (
        [#type] => fieldset
        [#title] => Personal information
        [#weight] => 1
        [profile_name] => Array
            (
                [#type] => textfield
                [#title] => First name
                [#default_value] => 
                [#maxlength] => 255
                [#description] => Enter your first name. The content of this field is kept private and will not be shown publicly.
                [#required] => 1
                [#input] => 1
4

1 回答 1

0

我认为,如果您必须在 $form 对象中找到“提交”数组并更改其中的数据。

例如:

$form['account']['mail']['#description'] = 'Enter a valid email address';

bocome这个(在我的情况下):

$form['submitted']['account']['mail']['#description'] = 'Enter a valid email address';
于 2014-01-22T15:27:40.310 回答