Create a free account to get access to additional free training videos. Enjoy this free video from CraftQuest! Create a free account to get access to additional free training videos. Join the Community

Creating a Craft CMS Field Type

Introduction to Creating a Craft CMS Field Type

Our goal with this course is learn the different pieces of a custom field type in Craft CMS and how easily we can bring them together to build something that we need for our site.

In this course we are going to learn how to cre­ate a cus­tom field type for Craft CMS. You may be watch­ing this because you’re curi­ous about how to extend Craft or, more like­ly, you find your­self in need of a cus­tom field type for Craft and want to know how to build it. 

Every imple­men­ta­tion is dif­fer­ent. You may need to pop­u­late your field type with data from an exter­nal data source or one of your plu­g­ins but the gen­er­al approach is the same. 

Our goal with this course is to learn the dif­fer­ent pieces of a cus­tom field type in Craft CMS and how eas­i­ly we can bring them togeth­er to build some­thing that we need for our site.

What We’re Building

In this course, we’re build­ing two dif­fer­ent field types. First, we’ll cre­ate a field that pro­vides a drop­down field of a list of world lan­guages. The label will be the lan­guage name, and the val­ue will be the lan­guage two-let­ter code.

While build­ing this field type, we’ll learn the fun­da­men­tals and tools we need to make just about anything.

We will take what we’ve learned and then build anoth­er field type that con­nects to Craft Com­merce. This field type, also a Drop­down field, will give us a drop­down field of the Craft Com­merce sub­scrip­tions plans we have enabled for the site.