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

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

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

| improve this answer | |

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.

| improve this answer | |
  • @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.