I'm making a front-end entry form with a Super Table field that is inside a Matrix field. Super Table docs at https://verbb.io/craft-plugins/super-table/docs/template-guides/front-end-form have an example with the following code to figure out a block type of Super Table field:

{% set fieldHandle = 'mySuperTableField' %}
{% set field = craft.fields.getFieldByHandle(fieldHandle) %}
{% set blocktype = craft.superTable.getSuperTableBlocks(field.id)[0] %}

If in my case I have a Matrix field with handle myMatrixFeild that contains mySuperTableField, how do I find out the block type of mySuperTableField?

1 Answer 1


That's more complicated, because fields in a Matrix are scoped to the Matrix field, which is why you can't just go:

{% set field = craft.fields.getFieldByHandle('superTableFieldInMatrix') %}

You'll need to loop through the Matrix's fields to find the Super Table field, then carry on as normal.

{% set matrixField = craft.fields.getFieldByHandle('myMatrixField') %}

{% for field in matrixField.getBlockTypeFields() %}
    {% if field.handle == 'mySuperTableField' %}
        {% set blocktype = craft.superTable.getSuperTableBlocks(field.id)[0] %}

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.