<p>Ok, I found this:</p>
<p><a href="https://docs.craftcms.com/api/v3/craft-services-elements.html#method-getallelementtypes" rel="nofollow noreferrer">https://docs.craftcms.com/api/v3/craft-services-elements.html#method-getallelementtypes</a></p>
<pre class="lang-php prettyprint-override"><code>Craft::$app-&gt;getElements()-&gt;getAllElementTypes()
</code></pre>

CC BY-SA 4.0
2021-01-04T23:11:51.947Z
Whilst this mostly works, in my case it doesn't include `Solspace\Calendar\Elements\Event` which is in the `elements → types` column. But it does include `verbb\supertable\elements\SuperTableBlockElement` which isn't in the same database column. Seems a bit backwards, but currently doesn't impact what I wanted to acheive.
Mark Notton
CC BY-SA 4.0
2021-01-04T23:07:40.227Z
2021-01-04T23:07:40.227Z
Mark Notton
<p>From within a plugin/module using PHP; is there a way to query all element types being used, including custom elements?</p>
<p>I know in the <code>elements</code> database table there is a <code>type</code> column that I could potentially query. But I wasn't sure if there is a native Craft method I could take advantage of instead?</p>
<p>In an ideal world I just need an array of all the element types:</p>
<p><strong>Example:</strong></p>
<pre class="lang-php prettyprint-override"><code>['asset', 'category', 'entry', 'globalset', 'matrixblock', 'tag', 'user', 'single', 'event', 'product']```
</code></pre>

<php><elementtype>
How to get all Element Types?
# How to get all Element Types?

(Asked by: username_0 on 2021-01-04)

From within a plugin/module using PHP; is there a way to query all element types being used, including custom elements?
I know in the elements database table there is a type column that I could potentially query. But I wasn't sure if there is a native Craft method I could take advantage of instead?
In an ideal world I just need an array of all the element types:
Example:
['asset', 'category', 'entry', 'globalset', 'matrixblock', 'tag', 'user', 'single', 'event', 'product']```

**Tags:** php, elementtype

---

## 1 answers

### Answer by username_0 on 2021-01-04. Score: 2 | Accepted answer

Ok, I found this:
https://docs.craftcms.com/api/v3/craft-services-elements.html#method-getallelementtypes
Craft::$app->getElements()->getAllElementTypes()

> **Comments:**
> **username_0**: Whilst this mostly works, in my case it doesn't include `Solspace\Calendar\Elements\Event` which is in the `elements → types` column. But it does include `verbb\supertable\elements\SuperTableBlockElement` which isn't in the same database column. Seems a bit backwards, but currently doesn't impact what I wanted to acheive.  

---

