<p>I think you already spotted it. </p>

<p>Change:</p>

<pre><code>&lt;ul class="small-block-grid-{{ textBlocks.blockGridNumber }}"&gt;
</code></pre>

<p>To:</p>

<pre><code>&lt;ul class="small-block-grid-{{ block.blockGridNumber }}"&gt;
</code></pre>

CC BY-SA 3.0
2015-02-01T19:34:50.490Z
Yeah i'm an idiot.
John
CC BY-SA 3.0
2015-02-01T17:59:54.503Z
2015-02-01T17:59:54.503Z
Douglas McDonald
<p>I've got a matrix with a Block type called textBlocks which Craft seems to be having trouble seeing.</p>

<p>The error is:</p>

<pre><code>Craft\MatrixBlockModel and its behaviors do not have a method or closure named "textBlocks".
</code></pre>

<p>My template code is:</p>

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

 {% switch block.type %}

{% case "text" %}


 &lt;div class="small-{{ block.columns }}"&gt;
  &lt;h3&gt;{{ block.blockTitle }}&lt;/h3&gt;
  &lt;p&gt;{{ block.blockContent }}&lt;/p&gt;
 &lt;/div&gt;


{% case "images" %}
 &lt;ul class="small-block-grid-{{ block.blockGrid }}"&gt;
  {% for asset in block.images %}
   &lt;li&gt;
    &lt;img src="{{ asset.getUrl() }}" alt=""/&gt;
   &lt;/li&gt;
  {% endfor %}
 &lt;/ul&gt;

 {% case "textBlocks" %}
 &lt;ul class="small-block-grid-{{ textBlocks.blockGridNumber }}"&gt;
  {% for row in block.textBlocks %}
   &lt;li&gt;&lt;h5&gt;{{ row.title }}&lt;/h5&gt; &lt;p&gt;{{ row.content }}&lt;/p&gt;&lt;/li&gt;
  {% endfor %}
 &lt;/ul&gt;
{% endswitch %}

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

<p>Am i getting this right here? When you do switch block.type is block.type the Block Type name?</p>

<p>See pic for my Matrix setup:
<img src="https://i.sstatic.net/WFn5f.png" alt="enter image description here"></p>

CC BY-SA 3.0
2015-02-01T17:48:22.877Z
Ah no, i have just made a code error like a fool!
John
<matrix>
Switch Matrix block on handle rather than type
# Switch Matrix block on handle rather than type

(Asked by: username_0 on 2015-02-01)

I've got a matrix with a Block type called textBlocks which Craft seems to be having trouble seeing.
The error is:
Craft\MatrixBlockModel and its behaviors do not have a method or closure named "textBlocks".

My template code is:
{% for block in entry.clientsContent %}

 {% switch block.type %}

{% case "text" %}


 
  {{ block.blockTitle }}
  {{ block.blockContent }}
 


{% case "images" %}
 
  {% for asset in block.images %}
   
    
   
  {% endfor %}
 

 {% case "textBlocks" %}
 
  {% for row in block.textBlocks %}
   {{ row.title }} {{ row.content }}
  {% endfor %}
 
{% endswitch %}

{% endfor %}

Am i getting this right here? When you do switch block.type is block.type the Block Type name?
See pic for my Matrix setup:

**Tags:** matrix

> **Comments:**
> **username_0**: Ah no, i have just made a code error like a fool!  

---

## 1 answers

### Answer by username_1 on 2015-02-01. Score: 3

I think you already spotted it. 
Change:


To:

> **Comments:**
> **username_0**: Yeah i'm an idiot.  

---

