de en
← Back to Articles

What are Element Types?

Craft Element Types - Teaser
Craft has introduced a concept of Element Types, which Pixel & Tonic now explains in more detail. Element Types is a paradigm shift compared to how other content management systems manage content.
One of the key innovations in Craft – make that the key innovation – is a new concept called “Element Types”. We’ve mentioned Element Types here and there, but we haven’t explained what they are yet, much less how plugins can take advantage of them. Now that Craft 2 is out, we’re finally ready to lift the curtain. - Pixel & Tonic

Elements

File systems manage files, iPhoto manages photos, iTunes manages media, and blog systems manage entries. A content management system manages content. Historically, content in a CMS almost means that content is mainly stored as entries. Of course, users, categories, or files can also be managed with a CMS, but only entries usually use user-defined fields or relationships.

While other content management systems manage Entries, Craft manages Elements. Everything in Craft is Elements, be it users, files, categories, tags, globals, or matrix blocks. Even entries are Elements in Craft. This makes Craft consistent and flexible because custom fields or relationships are available to all Elements.

Element types

Element Types are the classes with which the different elements are identified. There are "UserElementType", "AssetElementType" and so on. This model is similar to those of the classes for user-defined field types. The relationship between an element and an item is just like the relationship between a field and a field type.

As of Craft 2, the Element Type API is to the point where plugins can create their element types. Therefore, plugin developers have new possibilities, making the ecosystem even more diverse.

Photo from  Thomas Sausen<

Self-employed web developer from Germany who started with WordPress websites in 2005, then moved to ExpressionEngine and lost his heart to Craft CMS in 2013. As the founder of Craftentries, he has been covering the Craft ecosystem since 2015.

Thomas Sausen Web Developer