<p>You can get all available sources with </p>

<pre><code>field.getSourceOptions()
</code></pre>

<p>Which returns you an array of all sources, no matter if they are selected or not (just to get the ids and such)</p>

<p>and with </p>

<pre><code>field.sources
</code></pre>

<p>you'll receive an array if you selected several sources or a string (<code>*</code>) if all are selected. </p>

CC BY-SA 3.0
2018-02-01T07:08:37.360Z
2018-02-01T07:08:37.360Z
Robin Schambach
<p>I have an asset field (craft\fields\Asset), how do I figure out which Sources it can use? (Which of the Sources boxes are checked)?</p>

<p>This is for Craft 3, and I'd like to do it in twig (I have the asset field in twig)</p>

<craft3><assets-field>
which Sources of asset field are checked
# which Sources of asset field are checked

(Asked by: username_0 on 2018-01-31)

I have an asset field (craft\fields\Asset), how do I figure out which Sources it can use? (Which of the Sources boxes are checked)?

This is for Craft 3, and I'd like to do it in twig (I have the asset field in twig)

**Tags:** craft3, assets-field

---

## 1 answers

### Answer by username_1 on 2018-02-01. Score: 2 | Accepted answer

You can get all available sources with 
field.getSourceOptions()

Which returns you an array of all sources, no matter if they are selected or not (just to get the ids and such)
and with 
field.sources

you'll receive an array if you selected several sources or a string (*) if all are selected.


---

