<p>Something like this should do what you're looking for:</p>

<pre><code>{% for block in entry.body %}

    {% set fields = block.getFieldLayout().getFields() %}

    &lt;ul&gt;
        &lt;li&gt;{{ block.getType().name }}
        &lt;ul&gt;
            {% for field in fields %}
                &lt;li&gt;{{ field.getField().name }}
            {% endfor %}
        &lt;/ul&gt;
    &lt;/ul&gt;

{% endfor %}
</code></pre>

CC BY-SA 3.0
2017-05-08T09:03:31.610Z
I want to output label of field, not value of field.
Filip Bartnicki
CC BY-SA 3.0
2017-05-08T22:56:42.533Z
Sorry, misunderstood the question.  Updated answer.
Brad Bell
CC BY-SA 3.0
2017-05-05T21:13:13.993Z
2017-05-08T22:56:22.397Z
2017-05-08T22:56:22.397Z
Brad Bell
<p>I have Matrix field containing block with various fields. How can I output into template label of single field?</p>

<p>Can I get type of that field? (for example - textfield, dropdown field, etc.)</p>

<templating>
Get field Matrix field label inside template
# Get field Matrix field label inside template

(Asked by: username_0 on 2017-05-05)

I have Matrix field containing block with various fields. How can I output into template label of single field?

Can I get type of that field? (for example - textfield, dropdown field, etc.)

**Tags:** templating


---

## 1 answers

### Answer by username_1 on 2017-05-05. Score: 2

Something like this should do what you're looking for:
{% for block in entry.body %}

    {% set fields = block.getFieldLayout().getFields() %}

    
        {{ block.getType().name }}
        
            {% for field in fields %}
                {{ field.getField().name }}
            {% endfor %}
        
    

{% endfor %}

> **Comments:**
> **username_0**: I want to output label of field, not value of field.  
> **username_1**: Sorry, misunderstood the question.  Updated answer.  

---

