Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
Empty blocks are shown when they are empty, I think buildRegions show ask for content before adding them to region.
$build[$region][$block_id] = $block_render_array;
Attached is a patch.
Comment | File | Size | Author |
---|---|---|---|
#8 | buildregions_should-2660242-8.patch | 10.03 KB | legolasbo |
| |||
#5 | buildregions_should-2660242-5.patch | 1.82 KB | m.abdulqader |
#2 | buildregions_should-2660242-2.patch | 1.44 KB | m.abdulqader |
|
Comments
Comment #2
m.abdulqader CreditAttribution: m.abdulqader at Vardot commentedComment #3
m.abdulqader CreditAttribution: m.abdulqader at Vardot commentedComment #4
samuel.mortensonA similar fix is going to be included in #2664002: Quickedit not working for Content Blocks rendered using the StandardDisplayBuilder, but I'll keep this issue open until this or that one is closed.
Comment #5
m.abdulqader CreditAttribution: m.abdulqader at Vardot commentedTemporary solution until solving this issue.
This will check for empty blocks and empty regions as well.
Comment #7
legolasboWorking on this.
Comment #8
legolasboAttached patch is a new approach to this issue. It fixes the issue and refactors the build method into smaller methods to make this class more self documenting.
The gist of it is first build the regions and then add the prefix and suffix to the result of that build operation. Since only non-empty regions are added to the build, there will never be a prefix/suffix added to an empty region.
While working on this I also found out that the code was somewhat duplicated in
InPlaceEditorDisplayBuilder
, but differed in the attributes added to the wrapper. I therefor added a protected methodcalculateRegionWrapperAttributes
which is now overridden byInPlaceEditorDisplayBuilder
to add it's data attribute.After this patch is committed there should be several follow-ups.
StandardDisplayBuilderTest
into smaller units to make them more readable and maintainable.StandardDisplayBuilder
so we have our bases covered.InPlaceEditorDisplayBuilder
InPlaceEditorDisplayBuilder
Comment #9
legolasboComment #10
japerrySo this bug really was fixed in #2664002: Quickedit not working for Content Blocks rendered using the StandardDisplayBuilder so I'm marking this closed/fixed for now. If we want to refactor these other files, we should open up a different issue for that.