I want to add HTML attributes for my block by using
hook_block_view_alter. Any suggestions/code snippets for this?
Instead use Markup module. it easily integrates with the form. I am guessing u use D7...
This module adds the ability for site admins to add "Markup" widgets to the form. These essentially let designers of cck content-types insert additional markup into the node/edit form to display to content-authors. This is the equivalent of adding additional elements to $form of the type '#markup'.
The module does not add anything to the $node object for the content being created, and utilizes form_alter to remove unnecessary fields from the '_content_admin_field' form when this widget is being created.