I want to add HTML attributes for my block by using hook_block_view_alter. Any suggestions/code snippets for this?

closed as too broad by DRUPWAY, No Sssweat, mradcliffe, Pierre.Vriens, kiamlaluno Feb 23 '17 at 17:19

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    exactly what do you want to do? add HTML markup and attributes to block content ot to Block itself? – Yusef Feb 23 '17 at 9:40

If you need for D7, Block Attributes module or if you just need class Block Class


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.

  • @No Sssweat Then how do u plan doing it...??? The question is quite unclear.... – Anirban Neogi Feb 23 '17 at 11:58
  • It wasn't me who voted you down, I'll prove it by voting you up. I agree, the question is a bit broad, so this could be an option. – No Sssweat Feb 23 '17 at 12:05
  • @NoSssweat No problem... man... i checked it... actually you were also right....the question was quite unclear so i directly wrote the module name... – Anirban Neogi Feb 23 '17 at 12:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.