Difference in template suggestions between 'regular' block and same block via block_field

Created on 1 June 2021, over 3 years ago
Updated 23 April 2024, 5 months ago

Postponed on core issue: ✨ Template suggestions for custom block view modes Fixed

First, this is great, and thank you.

Problem/Motivation

Here are the template suggestions for the block placed directly in a region:

FILE NAME SUGGESTIONS:
   * block--basic.html.twig
   * block--content-bottom.html.twig
   * block--block-content--content-bottom.html.twig
   * block--content-bottom--financials-2.html.twig
   * block--content-bottom.html.twig
   x block--financials-2.html.twig
   * block--block-content--d2ae1a5e-355b-410f-a73f-96aa4e82c6fc.html.twig
   * block--block-content.html.twig
   * block.html.twig

And here are the template suggestions for the same block referenced with block_field (in a paragraph in a node):

FILE NAME SUGGESTIONS:
   * block--basic.html.twig
   * block--content-bottom.html.twig
   * block--block-content--content-bottom.html.twig
   * block--content-bottom--financials.html.twig
   * block--content-bottom.html.twig
   x block--financials.html.twig
   * block--block-content--d2ae1a5e-355b-410f-a73f-96aa4e82c6fc.html.twig
   * block--block-content.html.twig
   * block.html.twig

I guess this is really the difference between block content (edited at for example /block/27 and the block configuration that holds the content (edited for example at /admin/structure/block/manage/financials_2) and field_block only references the former, directly, correct?

Proposed resolution

Maybe this could be highlighted on the project page or other documentation a little more? The disconnect between how we usually interact with custom blocks (configure link on a page or /admin/structure/block) and block_field (same as the listing at /admin/structure/block/block-content) makes this worth mentioning i think.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ’¬ Support request
Status

Postponed

Version

1.0

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    I think we should postpone this on ✨ Template suggestions for custom block view modes Fixed so we first have a clear implementation in default, before touching things here?

  • πŸ‡ΊπŸ‡ΈUnited States AndySipple

    I can confirm the latest MR Template suggestions for custom block view modes ✨ Template suggestions for custom block view modes Fixed gives the correct twig template suggestions now.
    Using block_field to reference a block_content get the following for a block type text

    <!-- FILE NAME SUGGESTIONS:
       * block--whatisthemiseswire.html.twig
       * block--block-content--[block_content_unique_id].html.twig
       * block--block-content--id-view--[title_of_block_content]--full.html.twig
       * block--block-content--id--[title_of_block_content].html.twig
       * block--block-content--view-type--text--full.html.twig
       x block--block-content--type--text.html.twig
       * block--block-content--view--full.html.twig
       * block--block-content.html.twig
       * block.html.twig
    -->
    

    Get the following for the same block_content but used in block layout bundle

    <!-- FILE NAME SUGGESTIONS:
       * block--block-content--[block_region].html.twig
       * block--sidebar-second--mises-[title_of_block_content].html.twig
       * block--sidebar-second.html.twig
       x block--bundle--text.html.twig
       * block--mises-[title_of_block_content].html.twig
       * block--block-content--[block_content_unique_id].html.twig
       * block--block-content--id-view--mises-[title_of_block_content]--full.html.twig
       * block--block-content--id--mises-[title_of_block_content].html.twig
       * block--block-content--view-type--text--full.html.twig
       * block--block-content--type--text.html.twig
       * block--block-content--view--full.html.twig
       * block--block-content.html.twig
       * block.html.twig
    -->
    
Production build 0.71.5 2024