Can anyone provide a working example to extend the following code (add support for matrix block named "copy") and allow getPage usage:

{% set entries = craft.entries({
   section: ['news'],
   order: 'postDate desc',
   limit: 5,
   with: [
     ['assets', { kind: 'image' }]
}) %}

{% for content in entry.contentBuilder.type('copy').limit(1) %}
   {{ content.copy.getPage(1) }}
{% endfor %}

1 Answer 1


Update after Brad's comment since the with part seems to be ok - by the way thank you, it is another good example that you never stop learning.

I never saw that with attribute in a ElementCriteriaModel and after several searches I could not find any use of that attribute in craft (Please correct me if I'm wrong) the rest should be fine.

Instead of the .limit(1) you could do the following

{% set content = entry.contentBuilder.type('copy').first() %}

The getPage() function only exists in the class RichTextData maybe you have a different fieldType? Otherwise you could just do {{ content.copy }} as well to display the text in that field.

All in all it would be a good idea to tell us a little bit more about your goal, your fields and your errors. Your description is a little bit insufficient in my opinion


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.