1

I'm using Craft Pro 3.0.0-beta.19 and I try to query matrix blocks with craft.matrixBlocks(). Background: I have event series (=structure) with a matrix block containing 1:n dates for each series. My block type in the "dates" matrix block is "eventDate" and looks like this: Block Definition

this works:

{% set entries = craft.matrixBlocks() %}

Since this is the first matrix block I have I get all the entries I have (2):

{{ entries | length }} will output: 2 {{ entries.one().type }} will output: eventDate

Good.

Now I want to limit the blocks to eventDate only

{% set entries = craft.matrixBlocks.type('eventDate') %}

On the first glance this seems to work, I get the same results.

But when I change this to

{% set entries = craft.matrixBlocks.type('WhateverGoesHere') %}

I still get the same results. Am i not understanding this or is it a bug?

Thanks, Matthias

4
  • I really assume this is a bug. Also accessing the fields does not work, I posted an issue ticket on Github: github.com/craftcms/cms/issues/1789 Commented Jun 22, 2017 at 14:48
  • Curious if you get the same behavior on Craft 2 as well...
    – Brad Bell
    Commented Jun 23, 2017 at 3:51
  • Did craft.matrixBlocks exist on Craft 2? Commented Jun 23, 2017 at 6:45
  • Duh... nope it doesn't.
    – Brad Bell
    Commented Jun 24, 2017 at 3:06

1 Answer 1

1

This was a bug in a beta version of Craft 3 (fixed here: https://github.com/craftcms/cms/commit/9b6dad7385c5a82d1c83d230fe6ce0cfe940675b)

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.