<p>It does not appear to be in the matrix block model. <a href="http://buildwithcraft.com/docs/templating/matrixblockmodel" rel="nofollow">http://buildwithcraft.com/docs/templating/matrixblockmodel</a></p>

CC BY-SA 3.0
2014-06-12T01:11:42.370Z
2014-06-12T01:11:42.370Z
Steve Adams
<p><code>block.type</code> is actually an alias for a <code>getType()</code> function, which returns a new <em>MatrixBlockTypeModel</em> object. Those will output their handle by default, which is why it's possible to compare <code>block.type</code>  against block type handles. But MatrixBlockTypeModel also has a <code>handle</code> property, so this is totally possible:</p>

<pre><code>{{ block.type.handle }}
</code></pre>

CC BY-SA 3.0
2017-04-28T12:05:40.203Z
Unfortunately, this means that using:

`{% if block.type in ['video', 'image', 'gallery'] %}`

…does not seem to work, [as per this example](https://craftcms.stackexchange.com/a/2910/4208).

Is there another way? Using `in` is very tidy!
ianp
CC BY-SA 3.0
2017-04-29T16:18:13.327Z
@ianp You need `.name` after `block.type`
Brandon Kelly
CC BY-SA 3.0
2017-04-30T17:00:41.027Z
Thanks. I have tried that and no joy.

Just to be clear, `( block.type == 'video' or block.type == 'image' or block.type == 'gallery' )` does still work, however.
ianp
CC BY-SA 3.0
2017-04-30T17:16:17.113Z
Sorry I should have said `.handle`
Brandon Kelly
CC BY-SA 3.0
2014-06-12T01:21:09.833Z
2017-05-12T11:40:23.750Z
2017-05-12T11:40:23.750Z
Brandon Kelly
<p>I'd like to output the Names of Matrix Blocks. I know you can <a href="http://buildwithcraft.com/docs/matrix-fields#filtering-by-block-type">filter by block types</a> e.g.</p>

<pre><code>{% for block in entry.myMatrixField.type('text, heading') %}
{% if block.type == "heading" %}
    &lt;h3&gt;{{ block.heading }}&lt;/h3&gt;
{% else %}
    {{ block.text | markdown }}
{% endif %}
{% endfor %}
</code></pre>

<p>I know I could use <code>{{ block.type }}</code> and get the block type's handle but, I want to included the actual <em>Name</em> of the block type itself too.</p>

<p>For example, something like this:</p>

<pre><code>{{ block.type.name }}
</code></pre>

<p>Is this currently possible?</p>

<matrix><custom-field><blocks><filter><block-types>
Is it possible to output the name of a Matrix Block?
# Is it possible to output the name of a Matrix Block?

(Asked by: username_0 on 2014-06-12)

I'd like to output the Names of Matrix Blocks. I know you can filter by block types e.g.
{% for block in entry.myMatrixField.type('text, heading') %}
{% if block.type == "heading" %}
    {{ block.heading }}
{% else %}
    {{ block.text | markdown }}
{% endif %}
{% endfor %}

I know I could use {{ block.type }} and get the block type's handle but, I want to included the actual Name of the block type itself too.
For example, something like this:
{{ block.type.name }}

Is this currently possible?

**Tags:** matrix, custom-field, blocks, filter, block-types

---

## 2 answers

### Answer by username_2 on 2014-06-12. Score: 13 | Accepted answer

block.type is actually an alias for a getType() function, which returns a new MatrixBlockTypeModel object. Those will output their handle by default, which is why it's possible to compare block.type  against block type handles. But MatrixBlockTypeModel also has a handle property, so this is totally possible:
{{ block.type.handle }}

> **Comments:**
> **username_3**: Unfortunately, this means that using:  `{% if block.type in ['video', 'image', 'gallery'] %}`  …does not seem to work, [as per this example](https://craftcms.stackexchange.com/a/2910/4208).  Is there another way? Using `in` is very tidy!  
> **username_2**: @ianp You need `.name` after `block.type`  
> **username_3**: Thanks. I have tried that and no joy.  Just to be clear, `( block.type == 'video' or block.type == 'image' or block.type == 'gallery' )` does still work, however.  
> **username_2**: Sorry I should have said `.handle`  

---

### Answer by username_1 on 2014-06-12. Score: 2

It does not appear to be in the matrix block model. <http://buildwithcraft.com/docs/templating/matrixblockmodel>


---

