0
  • I have a custom block type, which uses its own theme template.
  • I have a display suite token field link_card_edit_block
  • It just uses HTML and tokens to create a link.
  • I want to use that field in my block type template.

  • Without the custom template, the field shows up.

  • If I add {{ content }} in the custom block template, the field shows.
  • But I can't figure out how show that field individually.

Here is what I have tried:

{{ content['#block_content'].field_link_card_edit_block.value }}
{{ content['#block_content'].field_link_card_edit_block[0] }}
{{ content['#block_content'].field_link_card_edit_block }}
{{ content.field_link_card_edit_block.value }}
{{ content.field_link_card_edit_block[0] }}
{{ content.field_link_card_edit_block }}

All of them produce nothing.

  • You probably copy-and-pasted these snippets from examples without Display Suites, but now you have additional regions in the display mode and you need a longer path to find the field inside of {{ content }}. – 4k4 Aug 1 '19 at 17:47
  • I did not copy and paste these. I was experimenting. What might those longer paths be? – Sarah C Aug 1 '19 at 17:49
  • This depends on how you've configured the Display Suite options for this display mode. As far as I can remember enabling the module adds already a default layer. Use kint() or Xdebug. – 4k4 Aug 1 '19 at 17:57
  • It would help to have an example of what a path would look like. Where would I use kint()? What would I be trying to find with it? What would it look like? – Sarah C Aug 1 '19 at 18:03
0

My teammate figured this out:

{{ content['dynamic_token_field:block_content-link_card_edit_block'] }}

|improve this answer|||||

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.