Custom Placeholder Module I have created a custom module to create a few placeholders in form fields.  Unfortunately, I am having a little trouble with getting two of them to work.  The code I have in the module is as follows:

function solid_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == 'search_block_form') {
    $form['search_block_form']['#attributes']['placeholder'] = t('enter search terms');
  }
  if ($form_id == 'user_login' || $form_id == 'user_login_block') {
    $form['name']['#attributes']['placeholder'] = t( 'Username or Email' );
    $form['pass']['#attributes']['placeholder'] = t( 'Password' );
  }
  if ($form_id == 'user_account_form') {
    $form['name']['#attributes']['placeholder'] = t( 'Username' );
    $form['mail']['#attributes']['placeholder'] = t( 'Email Address' );
    $form['pass[pass1]']['#attributes']['placeholder'] = t( 'Password' );
    $form['pass[pass2]']['#attributes']['placeholder'] = t( 'Confirm Password' );
  }
  if($form_id == "views_exposed_form"){
    $form['title']['#attributes'] = array('placeholder' =&gt; array(t('Search by Title')));
    $form['sku']['#attributes'] = array('placeholder' =&gt; array(t('Search by SKU')));
    $form['commerce_price_amount[min]']['#attributes'] = array('placeholder' =&gt; array(t('Min Price')));
    $form['commerce_price_amount[max]']['#attributes'] = array('placeholder' =&gt; array(t('Max Price')));
  }
}


(In order) The search block placeholder texts works perfectly.  The login placeholders also work perfectly.  The register (user_account_form) placeholders are not working at all, and I can not figure out why.  And the views_exposed_form works for the title and sku, but not for the min and max price range?  

I need helping figuring out what I did wrong on the register form, and the min/max view filter price range fields.

EDIT:  I have gotten everything to work except the registration passwords.  When I uncomment the line for the password fields, they are no longer displayed on the page.

    function solid_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == 'search_block_form') {
    $form['search_block_form']['#attributes']['placeholder'] = t('enter search terms');
  }
  if ($form_id == 'user_login' || $form_id == 'user_login_block') {
    $form['name']['#attributes']['placeholder'] = t( 'Username or Email' );
    $form['pass']['#attributes']['placeholder'] = t( 'Password' );
  }
  if($form_id == "views_exposed_form"){
    $form['title']['#attributes'] = array('placeholder' =&gt; array(t('Search by Title')));
    $form['sku']['#attributes'] = array('placeholder' =&gt; array(t('Search by SKU')));
    $form['commerce_price_amount']['#process'][] = 'placeholders_process_commerce_price_amount';
  }
  if ($form_id == 'user_register_form') {
    $form['account']['name']['#attributes']['placeholder'] = t( 'Username' );
    $form['account']['mail']['#attributes']['placeholder'] = t( 'Email Address' );
    //$form['account']['pass']['#process'][] = 'placeholders_process_password_confirm';
  }
}
function placeholders_process_password_confirm($element) {
  $element['pass1']['#attributes']['placeholder'] = t( 'Password' );
  $element['pass2']['#attributes']['placeholder'] = t( 'Confirm Password' );
  return $element;
}
function placeholders_process_commerce_price_amount($element) {
  $element['min']['#attributes']['placeholder'] = t( 'Min price' );
  $element['max']['#attributes']['placeholder'] = t( 'Max price' );
  return $element;
}
The user account form stuff is one level up in the account container. For the name and email you can use:

$form['account']['name']['#attributes']['placeholder'] = t( 'Username' );
$form['account']['mail']['#attributes']['placeholder'] = t( 'Email Address' );


The password is slightly more complicated, as the 2 inputs are created in a process function. You'll need something like:

function MYMODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  ...
  if ($form_id == 'user_account_form') {
    ...
    $form['account']['pass']['#process'][] = 'MYMODULE_process_password_confirm';
  }
  ...
}

function MYMODULE_process_password_confirm($element) {
  $element['pass1']['#attributes']['placeholder'] = t( 'Password' );
  $element['pass2']['#attributes']['placeholder'] = t( 'Confirm Password' );
  return $element;
}


See form_process_password_confirm() if you're wondering where 'pass1' and 'pass2' come from (it's one of the default process functions for a password_confirm element as set in system_element_info()).

It'll be the same sort of thing for the slider, but without knowing where that slider comes from (module, custom code, etc) it's difficult to say what the code should be. At a guess based on the input name's you're trying to target:

function MYMODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  ...
  if ($form_id == 'views_exposed_form') {
    ...
    $form['commerce_price_amount']['#process'][] = 'MYMODULE_process_commerce_price_amount';
  }
  ...
}

function MYMODULE_process_commerce_price_amount($element) {
  $element['min']['#attributes']['placeholder'] = t( 'Min price' );
  $element['max']['#attributes']['placeholder'] = t( 'Max price' );
  return $element;
}