0

I am working on a site with one special page layout (lets call it originally "two columns"), which has basically two columns: The left one showing page contents and the right one an unlimited number of paragraphs.

There is still one problem:

1) The twig tries to show also the paragraphs in the end of left column not following the without-filter. If I show the field title (content type Manage display) it shows the title in the bottom of the left column but no other output is generated of the field_aside paragraphs

2) I can't get the right column to show anything from the field_aside, whatever I try.

The crucial code comes here (the best idea what to do so far, tried a multitude of alternatives with zero results)

<div class="column is-three-quarters left-aligned main-area"">
    {{ content.body }}
  </div>
  <div class="column is-one-quarter left-aligned aside-area">
    Aside...
    {{ bamboo_render_field('field_aside', 'node') }}
  </div>

The page is using a Bulma based theme but I'd reckon it has nothing to do with the problem.

I have Bamboo Twig and Bamboo Twig Loaders enabled.

The field_aside should render the corresponding paragraph texts. wbr

hank

  • You're mixing template files here. Variables available in page.html.twig (such as {{ page }}) are not available in node.html.twig (which uses {{ node }}) and vice versa. – Hudri Feb 7 '18 at 11:55
  • I don't want to argue but actually, at least the top comment of page.html.twig lists also node as one of its variables. And if I output the following: {% for key,value in node.field_aside %} {{ key }} {{ dump(value) }} {% endfor %} I get one key printed (0) and an array of things clearly showing the relevant data about the paragraphs-field. – hank Feb 7 '18 at 14:19
  • Oh, really, never noticed the node variable in page.html.twig. However, {{ page.content }} refers to a region, so there aren't any node field variables available there. For the node part, the code looks good (as long as the route resolver can determine the node, see the comments in page.html.twig) – Hudri Feb 7 '18 at 15:01
  • Have you tried to render the paragraph that is referenced by your node in your preprocess and wrap it in a variable? Should be done like this -> drupal.stackexchange.com/questions/232122/… – Insasse Feb 8 '18 at 10:35
0

I am sorry, there was just a dumb error in the paragraph template that I used in testing. So, never mind...

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.