1

I'm using the entity_embed contrib module (8.x-1.2) in drupal 9.4. I embedding entities inside a node body in ckeditor.

The function mytheme_theme_suggestions_block_alter() is not called for block entities.

For embedded nodes it's working fine, I have a node.html.twig template inside the entity-embed-container. The problem is only for blocks, where are only field templates, no block.html.twig.

enter image description here

4
  • 2
    I believe you can configure which view mode(s) should be used when rendering the embedded entities. Then you can manage those displays the same as any other. The option should be in the Configuration > Content authoring area of the admin menu, but I forget if entity embed has its own configuration screen or if it's part of the text formats.
    – sonfd
    Aug 29, 2022 at 18:42
  • 1
    Just use the view modes.
    – Kevin
    Aug 30, 2022 at 12:21
  • I want to control the markup in a twig file. I can change the order of fields or properties in the admin "Manage display" page. But I want a custom markup.
    – zsd
    Aug 31, 2022 at 8:38
  • 1
    Using view modes can get custom markup....
    – Kevin
    Aug 31, 2022 at 17:53

1 Answer 1

1

I did not understand well the difference between block and block_content. Block content don't has its own template what I missed.

Here is an issue about this: https://www.drupal.org/project/drupal/issues/2366687

My solution was to use the block_content_template contrib module. So a got my twig file suggestions:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.