Problem/Motivation

Rendering content from paragraph.field.value|raw do not render entity embed properly.

Steps to reproduce

When I tried to render a view block or a custom block inside the tabs entity embed buttons on WYSIWYG, it did not render.
Install entity embed and views entity embed
Create an entity embed button to allow add custom block or a view.
Add a ixm blocks tabs to layout builder and try the ixm accordion block.

Proposed resolution

I have 4 proposed solutions:
1. Replace this: {{ item['#paragraph'].field_body.value|raw }}
Over this:

{% if item['#paragraph'].field_body %}
  {% set format = 'full_html' %}
  {% if item['#paragraph'].field_body.getValue()[0] %}
    {% set format = item['#paragraph'].field_body.getValue()[0].format %}
  {% endif %}
  {% set field_body = {
    '#text': item['#paragraph'].field_body.value|raw,
    '#type': 'processed_text',
    '#format': format,
  } %}
  {{ field_body }}
{% endif %}

2. Create a twig filter to render the field.
3. Use twig_tweak as dependency and use view filter, replacing this: {{ item['#paragraph'].field_body.value|raw }}
Over this: {{ item['#paragraph'].field_body|view }}

3. Hook preprocess the block to generate rendered content for the field and use that directly on the template.

Issue fork ixm_blocks-3294399

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

aluzzardi created an issue. See original summary.

aurora.luzzardi’s picture

Issue summary: View changes
aurora.luzzardi’s picture

StatusFileSize
new1.34 KB

I created a patch for solution 1, here is the patch:

aurora.luzzardi’s picture

I created a patch for solution 3.

aaronchristian’s picture

Status: Active » Reviewed & tested by the community

Awesome thanks @aluzzardi,

I think the twig tweak approach is cleaner, going to implement that patch as the fix moving forward.

Thanks for the contribution!

aaronchristian’s picture

  • AaronChristian committed b4f4e8c on 1.0.x
    Issue #3294399: Rendering content from paragraph.field.value|raw do not...
aaronchristian’s picture

Status: Reviewed & tested by the community » Fixed
aaronchristian’s picture

Status: Fixed » Closed (fixed)