Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Forms 修改单个字段表单输入(CSS、占位符等)Drupal 7注册表单预处理_Forms_Drupal_Attributes_Preprocessor_Textfield - Fatal编程技术网

Forms 修改单个字段表单输入(CSS、占位符等)Drupal 7注册表单预处理

Forms 修改单个字段表单输入(CSS、占位符等)Drupal 7注册表单预处理,forms,drupal,attributes,preprocessor,textfield,Forms,Drupal,Attributes,Preprocessor,Textfield,我正在尝试对注册表单的表单输入预处理CSS和占位符等。我正在手动呈现注册表上的每个字段输入 以下代码适用于电子邮件或密码,但不适用于“自定义字段” $form['account']['mail']['#attributes']['placeholder'] = t('Email address'); $form['account']['mail']['#attributes']['class'][] = 'email-input'; $form['account']['mail'

我正在尝试对注册表单的表单输入预处理CSS和占位符等。我正在手动呈现注册表上的每个字段输入

以下代码适用于电子邮件或密码,但不适用于“自定义字段”

$form['account']['mail']['#attributes']['placeholder'] = t('Email address');
    $form['account']['mail']['#attributes']['class'][] = 'email-input';
    $form['account']['mail']['#title_display'] = "invisible";
    $form['account']['mail']['#description'] = t('');
当我将其应用于自定义字段时,它不会应用。 我已经浏览了用户模块,并打印了Aviable Variables

$form['field_first_name']['#attributes']['placeholder'] = t('First Name');
    $form['field_first_name']['#attributes']['class'][] = 'first-name-input';
    $form['field_first_name']['#title_display'] = "invisible";
    $form['field_first_name']['#description'] = t('');

我在变量“打印输出”中发现多次提到字段“first”名称,但我无法直接修改文本输入。

尝试在呈现表单的tpl文件中更改表单值。它应该打印表单数组,并确保在修改字段时使用正确的嵌套数组。