将占位符文本添加到Drupal 7 user_register_form

时间:2015-10-22 16:52:08

标签: forms drupal drupal-7 placeholder

所以我可以让电子邮件和用户名字段正常工作。

这是代码

if ( TRUE === in_array( $form_id, array('user_register_form'))) {
   $form['account']['name']['#attributes']['placeholder'] = t(' Username ');
   $form['account']['name']['#title_display'] = "invisible"; 
   $form['account']['mail']['#attributes']['placeholder'] = t(' Your Email ');
   $form['account']['mail']['#title_display'] = "invisible"; 

}

这很好用。但似乎设置它的人在表单中使用自定义字段,因为它显示:

名=" profile_installer_contractor [field_installer_first_name] [UND] [0] [值]"

如何让这些字段显示占位符文字?我试过了:

 $form['account']['field_installer_first_name'][und][0]['value']['#attributes']['placeholder'] = t(' First Name ');

但这似乎不起作用。非常感谢任何帮助。

谢谢, 凯文

1 个答案:

答案 0 :(得分:0)

没关系,我自己想出来了。

task testJar(type: Jar) {
    from sourceSets.test.output
    version = System.getProperty('RELEASE_VERSION', "unversioned")
    appendix="test"
}
jar {
    version = System.getProperty('RELEASE_VERSION', "unversioned")
}

这很有用