Problem/Motivation

The objective is to be able to display [node:title] or other node tokens through a paragraph field on a node. Presently it does not work and only renders [node:title] as text.

Steps to reproduce:

  • Install token_filter module
  • Configure token filter module to use tokens on Rich Text fields (docs on how to do this in D7)
  • Create a Paragraph type with a Rich Text field
  • Create a Node type with a paragraph field using the Paragraph type
  • Create a new node using the Node type and for the Paragraph type's rich text field enter: "[node:title]"
  • Save and view the page and notice it displays "[node:title]" instead of the node's title

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

Comments

Syntapse created an issue. See original summary.

josephdpurcell’s picture

Title: How can I access [node:title] token from within paragraph entity on a node's paragraph field? » Access node tokens from within paragraph entity on a node's paragraph field using token filter
Category: Bug report » Feature request
Issue summary: View changes

Updating title and description and setting as "Feature request".

Syntapse’s picture

this is duplicate of https://www.drupal.org/project/paragraphs/issues/2927683.
adding comments there.

nixar’s picture

I think this feature is very important because Paragraphs is presented as the only alternative to field collections in D8. But Field collections always had a host token which would allow to reuse data from the host entity. It can be problematic for people trying to migrate their code from D7 w/ field collections to D8 w/ paragraphs.

Paragraph entities need a reference to the host entity and make the parent field available as tokens if the host exists.

My use case is this:
I have a meeting entity that has lots of text and file fields and child paragraphs for meeting handouts (file field, category taxonomy, description field).
The files are uploaded to a dynamic destination using filefield_paths to something like "meetings/[field_meeting_type]/[field_meeting_date]"
I really would like to be able to keep all my files in the same folder so ideally I would set up the file field in my handout paragraphs to use a custom upload folder set to something like "meetings/[host:field_meeting_type]/[host:field_meeting_date]" except there are no token for the host entity.

I'm not proficient enough with D8 to write a patch for this unfortunately.

jasonluttrell’s picture

@nixar your scenario mirrors my situation. I really would like to see something like that implemented.