When creating a custom block, how can we add a message and have it configurable by the user? Is this possible?


This is a good example for a Drupal 8 custom block that is configurable by the user

| improve this answer | |

A trick could be creating a content type called blockMessage or whatever you want and then using Views you can build your desired output for block of this content type which only outputs the last entered one (including message body).

Then whenever a new content of type blockMessage is posted its body will shown in this block as a message.

| improve this answer | |

Please check the example here. You'll need to create a hook_block_configure call.


| improve this answer | |
  • The question seems to be about Drupal 8. You send a link to Drupal 7 documentation – batigolix Sep 17 '16 at 11:39
  • I've updated the link. – Japo Domingo Sep 28 '16 at 22:32

Your Answer

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