add class to fields on login block I am using drupal 7 and would like to customise my login form block. 

function theme_form_alter(&amp;$form, &amp;$form_state, $form_id) {  


if ($form_id == "user_login_block") {
        $form['links'] = Null; // Remove Request New Password and other links from Block form
        //$form['links']['#markup'] = t('Forgotten Password?') . ' ' . t('Forgotten Password?') . ''; // Remove Request New Password from Block form
        //$form['links']['#markup'] = ' ' . t('Register') . '' . ' ' . t('Forgotten Password?') . ''; // Remove Request New Password from Block form

    $form['#prefix'] = '&lt;div class="nano-ui"&gt;';
    $form['#suffix'] = '&lt;/div&gt;';

    $form['name']['#attributes']['class'][]= array("nui-input");




    $form['name']['#title'] = Null; // Change text on form
    $form['name']['#attributes'] = array('placeholder' =&gt; t('username'));
    $form['pass']['#title'] = Null;
    $form['pass']['#attributes'] = array('placeholder' =&gt; t('password'));


}


}

In the above code the following line does not seem to have any effect on my field : 

$form['name']['#attributes']['class'][]= array("nui-input");
This is what will work

    $form['#prefix'] = '&lt;div class="nano-ui"&gt;';
    $form['#suffix'] = '&lt;/div&gt;';

   $form['name']['#title'] = Null; // Change text on form
    $form['name']['#attributes'] = array('placeholder' =&gt; t('username'));
    $form['pass']['#title'] = Null;
    $form['pass']['#attributes'] = array('placeholder' =&gt; t('password'));

    $form['name']['#attributes']['class'][] = 'nui-input';


Here is the reference : How do I use hook_form_alter() to add CSS classes to a custom input field in user_register_form?