This could become an alternative solution to #1703 / #2288 (we got some feedback that a "live preview" of the block content might be considered UI bloat by some) and also solve another small WTF...

While the two other issues are about custom blocks that are the most common use case where blocks end up having the same title in the "Manage blocks" page, there is a chance that people might be placing instances of other types of blocks more than once in the same layout. So, they might end up with say two "Recent comments" blocks or two "Primary navigation" blocks etc.

The WTF I was talking about is that certain blocks have their title hidden by default (which is the equivalent of the "None" option offered in the "Block title type" drop down). So why do we offer both "default" and "none" since the default is "none". A perfect example of such a block is the header block:


I think that D8 handles this in a better way:


Slightly different issue but similarly a WTF is the fact that we have the block title type set to "default" for most blocks, but we do not explain to the user what that "default" is. I mean, how is the user supposed to know that for the header block "default" means hidden (none) and for other blocks the very same thing means showing the title? Bottom line is that "default" simply does not make sense to a beginner, non-Drupal user.

So I thought that perhaps we could do this:

  1. Add a required title field to the config form of all blocks. Pretty much what D8 has.
  2. Have that field be prefilled with the block type ("Header", "Primary navigation", "Hero", "Custom block"). This way, there will be no validation error (because the field would not be empty) and the user can skip this field most of the times. In other words, we make a required field sorta optional.
  3. Have a "Hidden" checkbox under that block title field. Checking this will be hiding the block title from the front-end (the equivalent of our current "None" option), but would still allow having custom block titles for use in the admin UI ("Manage blocks" page).
  4. If the user does not change the title field, then the block title in the "Manage blocks" page will be the same as now.
  5. If the user changes the title to a custom one, then we show that as the block title in the frontend (if the "Hidden" checkbox is unchecked) and in the "Manage blocks" page we could show that custom title plus append the block type in brackets. So, for example we could have "Main menu" shown in the frontend and "Main menu (Primary navigation)" shown in the admin UI. Another example would be "Monthly Promotion" in the frontend vs. "Monthly Promotion (Custom block)" in the backend.
  6. We require that title to be unique within each layout. This way, adding say a second custom block and leaving the title to the default ("Custom block") would throw a validation error letting the user know that a block with the same name already exists in the layout being edited. This would force the user to choose a unique title and thus #1703 / #2288 would be non-issues.


GitHub Issue #: