1

I want to pull content from a field on an entry into a matrix block that is displayed on that entry.

I have entries that are shared between multiple sites. I'd like to be able to add a field on these entries that is only being utilized on one specific site. In order to do this I need to get the data from that field and insert it into a matrix block, is this possible?

1 Answer 1

1

The Preparse field can be used for this. It is a field type that parses Twig and saves the result as plain text. The Craft 3 version can be found here: https://plugins.craftcms.com/preparse-field?craft3

In the Twig for the preparse field, you can reference the field that you need to have in the matrix block.

So, for example, if the field in the entry is called myField, you could add a preparse field to the matrix block which has the following Twig content:

{{ element.myField }}

Then, when the entry is saved, the content of the preparse field will contain the contents of myField.

2
  • Thanks Steve! I'm not really sure how this can help me, would you mind explaining in a little more detail?
    – Sean G
    Commented Aug 29, 2023 at 17:39
  • I've added more detail to explain what I mean. Hope this is what you are after! Commented Aug 30, 2023 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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