Skip to content

Instantly share code, notes, and snippets.

@ChezFre
Created March 21, 2014 21:20
Show Gist options
  • Save ChezFre/9696767 to your computer and use it in GitHub Desktop.
Save ChezFre/9696767 to your computer and use it in GitHub Desktop.
Add placeholder to form elements in Drupal
/**
* $vars['#id''] = Form ID, can be found via Krumo
* $vars['field_name'] = Name of the input element you want to access
*/
function theme_form_alter(&$vars) {
//krumo($vars);
if( $vars['#id'] = " ") {
$vars['field_name']['#attributes']['placeholder'] = "Placeholder";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment