I have strange issue and cannot find out the solution for that. I have this field (matrix with some text values): https://i.stack.imgur.com/tgWM7.jpg

Also I have this entry: https://i.stack.imgur.com/ALAuL.jpg

And this is how it rendered (it shows not value of fields but id of matrix block table): https://i.stack.imgur.com/twsHX.jpg

Here is how it looks like in template: https://pastebin.com/viVbPLqj

I've tried multiple combinations but nothing was solution. Also other fields are works well (fields which not related to "companyInformation" matrix).

So what may I do wrong?

  • When you dump reviewFeatured.relatedCaseStudy.first.companyInformation.companyName what is the result ? Jan 28, 2019 at 18:25
  • @MaximeLafrenière it's here (marked by red cycle): imgur.com/a/SR3HgQZ It's an ID of companyInformation in 'matrixblocks' table
    – Clark
    Jan 28, 2019 at 18:38

1 Answer 1


Technically the data you're seeking are under the first matrix block (not the first data of your .companyName - which is not valid)

{% set relatedCaseStudy = reviewFeatured.relatedCaseStudy.first %}
{% set firstCompany = relatedCaseStudy.companyInformation.first %}
{{ firstCompany.companyName }}

Note: If you plan to have only one company, think about a SuperTable field in 'static' mode (only one occurence).

  • And how to find out what field types I need to fetch via "first", and which not? I've installed "inspector" plugin but it ain't helps. Twig's dump function also not good (absolutely exactly).
    – Clark
    Jan 30, 2019 at 10:15
  • 1
    .first is in fact a function that return the "first" element of an array/object. Every 'simple' fields (text, dropdown, etc.) aren't concern by this method. You can read the whole documentation fields that on Craft' website. There's a example for each field. (docs.craftcms.com/v2/fields.html#field-types) Jan 30, 2019 at 14:39

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.