I'm just starting to explore the whole power of Craft and I'm really satisfied with its possibilities so far.

But I can't get one thing done, so here's my question:

Is it possible to use matrix fields in my very own plugins? I already finished a form with several fields just as text inputs and stuff but I really need to extend this thing with a matrix field.

Am I just blind and it's documented anywhere or is it a more complicated task than I can imagine at this point?

Thanks for your help.


  • 1
    One thing you might want to consider, if all your plugin does is collects input, is to use something like Guest Entries/frontend edit form to do the same. If you do need to do some custom processing on the collected data, you might hook into any of the available events, like onSaveEntry. – Fred Carlsen Sep 23 '14 at 13:49
  • Don't know how you plan to store your data but you might want to take a look at the Element API to create your own element and use it with any available fields (just like Entries, Assets, etc...) – Benjamin David Sep 23 '14 at 14:07
  • Thanks guys, I will try Brandons solution which seems to be kinda the same Benjamin offered?! Anyway, thank you. – LikeAJohny Sep 24 '14 at 9:31

Matrix fields can only be used as custom fields, on an element.

If you really want to use them, you would need to create a custom Element Type (see the resources at the bottom of http://buildwithcraft.com/docs/plugins/working-with-elements), and then create a Matrix field that is associated with your element type’s field layout.

  • Is it applied for craftcms 3.x as well or we can add directly now without creating the element type. – inrsaurabh Feb 12 '20 at 14:26
  • 1
    @inrsaurabh Same answer applies to Craft 3 – Brandon Kelly Feb 12 '20 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.