3

Blocks are plugin in Drupal-8, I need to add a form element in the block add form & all the block edit forms. I am able to add the new form element in the form by form alter. But i need to get the block id on submit(custom submit handler). For block add forms block id has to be new block created & for block edit form, the existing block id.

How can i get the block id?

1

Have a lookt at Extend Block Class and my answer there about the block_class module.

It does exactly the same to add configurable CSS classes to blocks.

  • 1
    Block class is allowing to add classes to all the existing block, but it is not adding class field to new custom block plugins. I also need to display my form element while adding as well as editing custom blocks. – neha Nov 29 '16 at 8:32
  • 3
    It supports those too. Creating custom blocks is a two-step process, you first create the block and then put it in a region, on that step you can also configure the same settings as with all other blocks. – Berdir Nov 29 '16 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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