Best practices for sharing and developing types with dexterity

Hello,

I'm new to Plone and I think I've consulted all, or almost all, of the documentation about creating content types.

My question is which is the best way to develop and maintain the types of content.

Option 1. From the site (/dexterity-types) using dexterity, exporting the types in ZIP and importing them in another site.

Option 2. Creating a package with the content type with mrbob and bobtemplates.plone.

But would it possible to create the types with Dexterity from a site and then import it as an addons?

In my opinion:

If you are new to Plone, make them in the Dexterity Control panel

From there you can do a lot: You can export them and import them as ZIP, or (as I prefer to) export them in /portal_setup (or maybe in the Dexterity control panel) and put them in your add-on.
If you find it difficult to figure out 'what to copy', you could consider:

  1. Delete all 'other content types'
  2. Add your own
  3. Export them and put them in your add on

There is one thing you might want to change, it is the line that says 'folderish', you might want 'plone.dexterity.content.Item'
If you do something 'special', it can be quite useful to add it as a behavior, then it is easy to reuse your code

Hi Pablo,

Welcome to Plone :slight_smile:

You certainly can do this! Create your content types through-the-web then export them (export option within the @@dexterity-types control panel) and add them to an add-on (this can be built using the method you outline as Option 2).

In fact, I seem to recall that there's a tutorial for this in the Plone Training docs...

This might be helpful:
https://training.plone.org/5/mastering-plone/export_code.html

Good luck :+1:

1 Like