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.
Problem/Motivation
I was creating a View with 2 block displays to use on the Umami term page. One display would show Recipes and the Articles for the term.
Since they are both in the same view their placeholders are both the same.
You can see here that you can tell which display it is by configuring the block but otherwise you can't
Proposed resolution
Add the display name to the placeholder.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#15 | interdiff_13-15.txt | 1.38 KB | vadim.hirbu |
#15 | 3045812-15.patch | 1.82 KB | vadim.hirbu |
#13 | 3045812-13.patch | 1.61 KB | Lendude |
#13 | interdiff-3045812-7-13.txt | 877 bytes | Lendude |
#12 | Screenshot from 2019-04-15 12-15-22.png | 105.39 KB | vadim.hirbu |
Comments
Comment #2
tim.plunkettThis is controlled directly by the Views module
Comment #3
vadim.hirbu CreditAttribution: vadim.hirbu at FFW commentedAdd display name to Views block placeholder.
Comment #4
vadim.hirbu CreditAttribution: vadim.hirbu at FFW commentedComment #6
tim.plunkettThe change needs to be made in
\Drupal\views\Plugin\Block\ViewsBlockBase::getPreviewFallbackString()
, not in Layout Builder.Comment #7
vadim.hirbu CreditAttribution: vadim.hirbu at FFW commentedAdd display name to Views block placeholder in
\Drupal\views\Plugin\Block\ViewsBlockBase::getPreviewFallbackString()
Comment #8
Eitisha CreditAttribution: Eitisha commentedHi @vadim,
The patch applied successfully and looks good.
Comment #9
mark_fullmerComment #10
mark_fullmerConfirming that the patch in #7 successfully appends the view display name in the context of the Layout Builder preview.
Comment #11
LendudeIt would also be nice to update the IS to show the new results in a screenshot to evaluate if this makes things better (I'm sure they do, but nice to be able to see the result).
Also, this needs tests.
Comment #12
vadim.hirbu CreditAttribution: vadim.hirbu at FFW commentedUpdated Issue Summary with a screenshot after patch was applied.
Comment #13
Lendude@vadim.hirbu here is a sample test for this, this shows a problem in the patch ($this->pluginDefinition["admin_label"] can not be set) and needs a proper check on the actual expected text, but hopefully this can help you get rolling on tests! If you need some more help feel free to ping me on slack.
Comment #15
vadim.hirbu CreditAttribution: vadim.hirbu at FFW commentedThank you @lendude for test example. It helped me to understand the idea of tests.
I've updated the test and the patch itself.
Comment #16
nord102Confirming that patch #15 successfully appends the view display name in the context of the Layout Builder preview.
Comment #17
webchickThis looks like a nice little improvement in clarity, thanks!
Committed and pushed to 8.8.x!
Also note that I expanded the credit, since it looks like this was worked on at the DrupalCon Seattle sprints. Welcome, contributors! :D
Comment #21
smustgrave CreditAttribution: smustgrave at Mobomo commentedClosed https://www.drupal.org/project/drupal/issues/3014099 as a duplicate of this. Moved over credit.