<p>This can be done like so...</p>

<pre><code>{% set matrix = craft.app.fields.getFieldByHandle('myMatrixField') %}
{% for field in matrix.blockTypeFields if field.handle=='myDropdownField'  %}
    &lt;select&gt;
    {% for option in field.options %}
        &lt;option value="{{ option.value }}"&gt;{{ option.label }}&lt;/option&gt;
    {% endfor %}
    &lt;/select&gt;
{% endfor %}
</code></pre>

CC BY-SA 4.0
2019-08-23T14:49:34.530Z
2019-08-23T14:49:34.530Z
foamcow
<p>I'm asking this outside an entry context.</p>

<p>My starting point is </p>

<blockquote>
  <p>{% set field = craft.app.fields.getFieldByHandle('matrixFieldHandle')
  %}</p>
</blockquote>

<p>When I print the data of the field, I find nothing related to the fields that <code>matrixFieldHandle</code> contains.</p>

<ul>
<li><code>matrixFieldHandle</code> (Matrix field)

<ul>
<li>Block <code>Log</code>

<ul>
<li>Field <code>logValue</code> (Dropdown field)</li>
</ul></li>
</ul></li>
</ul>

<p>I know how to print the options in a dropdown field:</p>

<ul>
<li><a href="https://craftcms.stackexchange.com/questions/2205/how-do-i-output-a-dropdowns-values-if-im-on-a-registration-form-not-tied-to-an">How do I output a dropdown&#39;s values if I&#39;m on a registration form not tied to an entry?</a></li>
<li><a href="https://craftcms.stackexchange.com/questions/18853/how-do-i-print-the-options-in-a-dropdown-field">How do I print the options in a dropdown field?</a></li>
</ul>

<p>But how can I print all these dropdown options when it is set inside a Matrix?</p>

CC BY-SA 4.0
2018-09-06T15:02:55.777Z
What happens if you loop through field and print field.log?
Urs
CC BY-SA 4.0
2018-09-06T15:06:42.473Z
I get a Twig Runtime Error: Calling unknown method.
Romain P.
<templating><matrix><field><drop-down>
How to print all possible options of a dropdown field inside of a Matrix field?
# How to print all possible options of a dropdown field inside of a Matrix field?

(Asked by: username_0 on 2018-09-06)

I'm asking this outside an entry context.

My starting point is

> {% set field = craft.app.fields.getFieldByHandle('matrixFieldHandle')
> %}

When I print the data of the field, I find nothing related to the fields that `matrixFieldHandle` contains.

* `matrixFieldHandle` (Matrix field)
  + Block `Log`
    - Field `logValue` (Dropdown field)

I know how to print the options in a dropdown field:

* [How do I output a dropdown's values if I'm on a registration form not tied to an entry?](https://craftcms.stackexchange.com/questions/2205/how-do-i-output-a-dropdowns-values-if-im-on-a-registration-form-not-tied-to-an)
* [How do I print the options in a dropdown field?](https://craftcms.stackexchange.com/questions/18853/how-do-i-print-the-options-in-a-dropdown-field)

But how can I print all these dropdown options when it is set inside a Matrix?

**Tags:** templating, matrix, field, drop-down

> **Comments:**
> **username_1**: What happens if you loop through field and print field.log?  
> **username_0**: I get a Twig Runtime Error: Calling unknown method.  

---

## 1 answers

### Answer by username_2 on 2019-08-23. Score: 2

This can be done like so...
{% set matrix = craft.app.fields.getFieldByHandle('myMatrixField') %}
{% for field in matrix.blockTypeFields if field.handle=='myDropdownField'  %}
    
    {% for option in field.options %}
        {{ option.label }}
    {% endfor %}
    
{% endfor %}


---

