Is it possible to get all elements in a Matrix field by type or field name I found a way to do something like this

 {% set allBlocks =  craft.entries.matrixes %}


Which seems to return all the matrix blocks.. or at least I think it is?

But if try to filter down like:

  {% set allBlocks =  craft.entries.matrixes.type('document') %}


I get nothing.

Any ideas how to get all the Matrix blocks by type or better still all the Matrix blocks in a particular field?

Would i need to setup a plugin for this?
There is no craft.entries.matrixes variable available natively in Craft.

(craft.entries returns an ElementCriteriaModel, which does not have a matrixes property explicitly set.)

So, craft.entries.matrixes is actually looking for ElementCriteriaModel-&gt;matrixes(), which could implicitly exist if:


You have a field called matrixes, or
There's a plugin in the mix that is changing functionality


You'll need a plugin to run these custom queries. Luckily Craft's MatrixService has plenty of methods that would be helpful.

Also, Low created a plugin (LowBlocks) to do this sort of thing, which might fit your need, or at least offer a helpful starting point.