Body: <p>In the code below I am trying to check for the presence of a quote block to help define some layout columns.</p>
  
  <p>As soon as i count an individual block, the loop block below it outputs nothing. If remove the column logic based on length of quote block the loop below then outputs.</p>
  
  <pre><code>{# position columns width if there is a quote #}
  {% if entry.contentBlock.type('quote').limit(1) | length %}
      {% set col1 = "12u$(medium) 7u  " %}
      {% set col2 = "5u 12u$(medium)  " %}
  {% else %}
      {% set col1 = "12u$(small) 6u -3u  " %}
      {% set col2 = "hide " %}
  {% endif %}
  
  &lt;div class="{{ col1 }}"&gt;
      &lt;h3&gt; {{ entry.title }} &lt;/h3&gt;
  
      {% for block in entry.contentBlock.all() %}
          {% if block.type.handle == "text" or block.type.handle == "image" %}
              {% include ('page/_partials/_' ~ blockPrefix ~ 'block_' ~ block.type.handle) %}
          {% endif %}
      {% endfor %}
  &lt;/div&gt;
  
  &lt;div class="{{ col2 }}"&gt;
      {% for block in entry.contentBlock.type('quote').all() %}
          {% include ('page/_partials/_' ~ blockPrefix ~ 'block_' ~ block.type.handle) %}
      {% endfor %}
  &lt;/div&gt;
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-27T04:43:27.217Z
Comments.Text: I'm assuming this is for Craft 3?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-21T14:28:05.307Z
Comments.Text: Yes this is for craft 3
Comments.UserDisplayName: joomkit
Tags: <matrix>
Title: Why does calling matrix block type before matrix block loop lead to no loop output
ThreadText: # Why does calling matrix block type before matrix block loop lead to no loop output
  
  (Asked by: username_0 on 2018-11-25)
  
  In the code below I am trying to check for the presence of a quote block to help define some layout columns.
  
  As soon as i count an individual block, the loop block below it outputs nothing. If remove the column logic based on length of quote block the loop below then outputs.
  
  ```
  {# position columns width if there is a quote #}
  {% if entry.contentBlock.type('quote').limit(1) | length %}
      {% set col1 = "12u$(medium) 7u  " %}
      {% set col2 = "5u 12u$(medium)  " %}
  {% else %}
      {% set col1 = "12u$(small) 6u -3u  " %}
      {% set col2 = "hide " %}
  {% endif %}
  
  <div class="{{ col1 }}">
      <h3> {{ entry.title }} </h3>
  
      {% for block in entry.contentBlock.all() %}
          {% if block.type.handle == "text" or block.type.handle == "image" %}
              {% include ('page/_partials/_' ~ blockPrefix ~ 'block_' ~ block.type.handle) %}
          {% endif %}
      {% endfor %}
  </div>
  
  <div class="{{ col2 }}">
      {% for block in entry.contentBlock.type('quote').all() %}
          {% include ('page/_partials/_' ~ blockPrefix ~ 'block_' ~ block.type.handle) %}
      {% endfor %}
  </div>
  
  ```
  
  **Tags:** matrix
  
  > **Comments:**
  > **username_1**: I'm assuming this is for Craft 3?  
  > **username_0**: Yes this is for craft 3  
  
  ---
  
  ## 0 answers
  
  