I am wondering if there is a way to re-use pre defined field types and image crops over various Craft projects. I currently in the process of e.g. manually defining 20 different image crops I already defined for another project, which is a tedious task.

I am not really familiar with SQL and database structures, so I am not sure if there is a way to simply copy fields from one projects database to another or if this would corrupt my database?

1 Answer 1


You have several options to solve this issue.

Import fields via plugin

You could create a plugin that handles all these function in it's installation callback so you would install the plugin and have all the things you need. But this requires basic knowledge in plugin development.

Advantage When Pixel and Tonic make any changes in their install process it won't infect your code and if you are going to make multiple plugins you'll be able to import the required fields whenever you use them. That's the way we handle it and when someone installs my Form Builder Plugin it includes a form relation field to each entries with type pages and some crop rules automatically.

Disadvantage You need to learn php

Import via SQL

Install a new Craft instance, insert all your default values you would like to have for a new project and export the entire database. When you start a new project you would skip the installation process but import your included database and the files of your "default" instance.

Advantage This is an easy and really fast way to achieve your goal. It does not require any knowledge or skills

Disadvantage You should pay attention when Pixel and Tonic makes core changes in their default structure or things could eventually break in the future (even if it is really unlikely because they are really careful with those things)

Search for a plugin from someone else that handles it

I know there is a Feed Me Plugin maybe this does what you want but I never really used plugins that are not created in my company so I can't tell something about it

  • Thanks for your suggestions, Robin! I actually managed to take the "Import via SQL" route, using Sequel Pro to access the database and export only the craft_assettransforms table there. Reimported this singular table in my new project and all the transforms seem to be there. So basically I could do the same with alle the other pre-defined stuff, right? Maybe even keep those individual table dumps as Templates for new projects.
    – Tobias S.
    Commented Dec 27, 2017 at 12:43
  • Yes that works for asset transforms. Since you said you are not familiar with SQL I did not suggest you to only import one single table because depending on the things you already included into the other system there could be errors if you don't pay attention. If your 2nd project is still empty it's all good. Most fields will work too but you need to know what you do when you want to import matrix fields because the table relations must all be correct, otherwise the entries will not populate correctly. Commented Dec 27, 2017 at 12:55
  • And if you are going to include fields you either have to resave them or you have to create the corresponding columns in your craft_content table too (or include the entire table if you are going to reuse all fields). It's the same for entry types and sections. They have so called foreign key contains (so the ids must all match) that's why you need to import all those related tables or row per row really carefully. If you are going to use Craft 3 in the future it becomes even more complicated this way. That's why I suggest to import everything Commented Dec 27, 2017 at 12:58
  • Thanks for the further details, Robin. I'll consider all this.
    – Tobias S.
    Commented Jan 19, 2018 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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