Blocks can have different view modes and it would be helpful if this module supported that granularity for templates.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | block_type_templates-view_mode_support-3018307-7.patch | 3.07 KB | chris burge |
Blocks can have different view modes and it would be helpful if this module supported that granularity for templates.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | block_type_templates-view_mode_support-3018307-7.patch | 3.07 KB | chris burge |
Comments
Comment #2
chris burge commentedTake a look at this article: https://www.phase2technology.com/blog/big-bad-layout
The author provides a code sample that would be very easy to implement here:
Comment #3
chris burge commentedComment #4
chris burge commentedPatch attached. I re-organized the code a bit to better accommodate the addition of the view-mode suggestion code. I also added some comments.
This patch assumes that all BlockContentInterface instances have a view mode. If this isn't the case, let me know, and I'll add a check.
The original code assumes that 'block__block_content' may be not be present as a suggestion. I left this in, even thought I'm not sure where this would occur off the top of my head.
Comment #5
nerdstein@Chris Burge -- thank you. I did a code review of the patch and it looks good. We can work on testing this soon. Here are some steps:
1. Enable the module and load the patch
2. Create a custom block type and a new view mode
3. Create a corresponding template for that block type and view mode
4. Verify the markup shows up upon rendering
Comment #6
chris burge commented@nerdstein - I'm going to submit another patch that also updates README.md.
Comment #7
chris burge commentedPatch attached.
Comment #8
daggerhart commentedHad a bit of trouble testing this because none of the core D8 mechanisms for rendering blocks with alternate view modes seem to render blocks like regions do.
I was ultimately able to get this working with the "Full" view mode, which proves that it works. RTBC
Comment #9
chris burge commentedIf #3067045: Add classes to blocks gets committed first, then we'll need to update this patch to also add a class for the view mode.
Comment #11
nerdsteinFixed - thank you both so much.