The Umami demo profile defines two profile-specific blocks via custom code: "Umami disclaimer" and "Umami Footer promo".
It is unusual for an install profile to define its own blocks like that. It is also unnecessary; Drupal 8 has fieldable custom blocks, which can easily be used here (the two blocks don't have any special behavior, just some text fields and such).
Switching to custom blocks would allow the install profile to follow best practices, and it would also replace lots of custom code with configuration, which is good for the overall stability of the profile. Furthermore, the "Umami Recipes Banner" block already uses fieldable custom blocks, so changing the other two blocks over makes the code more consistent.
In addition to the general improvements noted above, this change would lead to several specific improvements also:
- It fixes several bugs with the "Find out more" link, including a security issue (see #2938904: "Find out more" link isn't validated or properly displayed, leading to bugs including cross-site scripting).
- It allows the "Quick Edit" feature to be used on the block content.
- In general, it allows the blocks to be much more configurable, using Drupal's standard field UI.
Comment | File | Size | Author |
---|---|---|---|
#16 | Screen Shot 2018-02-01 at 3.53.34 AM.png | 514.22 KB | navneet0693 |
#16 | Edit custom block Umami disclaimer I drupal 8.6.png | 357.78 KB | navneet0693 |
#16 | Edit custom block Umami footer promo I drupal 8_6.png | 260.63 KB | navneet0693 |
#14 | umami-blocks-2938900-14.patch | 38.34 KB | David_Rothstein |
#11 | umami-blocks-2938900-11.patch | 38.34 KB | David_Rothstein |
Comments
Comment #2
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedHere is a patch.
Although the patch is large in terms of file size, it is actually very straightforward - as noted above, most of what it does is just delete custom code and move it over to config files instead.
The visual appearance of the blocks should not change at all (comparing a site installed before this patch to one installed after).
Note: Another possible improvement here would be to make the "3 issue bundle" image associated with the footer promo block into an uploaded image field (similar to how the "Umami Recipes Banner" does it), rather than hardcoded in the theme. Currently, however, the patch does not do this.
Comment #3
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedAdded link to the security issue that this patch fixes to the issue summary, plus several minor edits.
Comment #4
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedI am tentatively marking this as a beta blocker, for two reasons:
Also, note that after this patch, the install profile essentially has no custom runtime code remaining, which would really mean it can do whatever it wants to do in the future (functionality-wise) without worrying about breaking anything for anyone.
Comment #6
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedThose test failures look fixable - I will look into them a little later.
Comment #7
markconroy CreditAttribution: markconroy as a volunteer and at Annertech commentedDavid,
Thanks for this work, I'll try get some time later on this play with it.
Hopefully some of the backenders on the project can do the same.
Looks like it's some great work.
Comment #8
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedThanks!
Meanwhile, the attached patch should fix the tests (it looks like there was a minor mistake during the configuration export that caused the tests to fail).
Comment #9
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commentedIt works like charm! I manually tested it.
Comment #10
larowlan@navneet0693 is there a chance you took screenshots of before after?
Comment #11
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedThe patch no longer applied (due to #2938170: Enable ALT text for Banner Block image field. being committed).
Here's a reroll - the only conflict was in the tests (
core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php
). Hopefully can be a quick re-RTBC.Regarding screenshots, there is supposed to be no change to the visual appearance before/after this patch.
Comment #12
larowlanAgree, was just asking if #9 had screenshots to verify
Comment #13
JayKandariPatch #11 didn't apply correctly with
.
However I tried to apply it via
patch -p1 < umami-blocks-2938900-11.patch
it patches everything except the following one file.Patch Review:
InstallHelper::importBlockContent()
Apart from the patch applying, this seems a great solution. In our previous OOTB meetings, we have had a discussion regarding blocks, as to keep these blocks as custom or the default custom blocks provided by core.
The actual design of Umami homepage has few more blocks. They can also be implemented in a similar way. There was some previous work doe around this. Not sure if this is relevant or not.
Marking this as "needs work" - just for not cleanly applying patch. else its good for RTBC. :) Cheers !!
Thanks!
Comment #14
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedThanks for the review.
I rerolled the patch to fix the conflict with #2939940: Update stylelint rules color-hex-case to be consistent with Drupal's CSS standards (there was no change to the actual patch, just the surrounding code).
Comment #15
markconroy CreditAttribution: markconroy as a volunteer and at Annertech commentedWe live tested this on the weekly call today and are happy to RTBC it. Thanks a lot @david_rothstein for all your work on this.
Comment #16
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commented@larowlan Apologies for responding to your comment. Attaching screenshots.
Comment #17
larowlanadding @JayKandari to issue credits
Comment #18
larowlanCommitted as b1e477e and pushed to 8.6.x
Thanks
Comment #20
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedI wrote a patch for this at #2942007: Move the footer promo block image to a field, for better configurability and accessibility.