Table of Contents

Content-Type Composition and Inheritance (new v18.02)

This explains Content-Type Composition and Inheritance. For an overview check out Understanding Data....

What is Content-Type Composition?

Content-Type Composition is the ability to create a new Content-Type by combining fields from existing Content-Types. This is a powerful feature which allows you to create new Content-Types by reusing existing fields.

Here's a simple example:

  1. You have a Person Content-Type with fields like Name, Email, Phone, Salutation
  2. You have a Company Content-Type with fields like Name, Address, Phone
  3. You want to create a Contact Content-Type with fields like Name, Email, Phone, Address, Salutation, Relationship

With Content-Type Composition, you can create the Contact Content-Type by combining fields from Person and Company. This is what you could do:

Field Person Company Contact Notes
Name 🔊 Master 🚫 Own Field 🔗 Inherit Company name has different description etc. so it does not inherit
Email 🔊 Master 🔗 Inherit
Phone 🔊 Master 🔗 Inherit 🔗 Inherit
Address 🔊 Master 🔗 Inherit
Salutation 🔊 Master 🔗 Inherit
Relationship 🚫 Own Field

Or you could do this:

Field PersonShared Person Company Contact Notes
Name 🔊 Master 🔗 Inherit 🚫 Own Field 🔗 Inherit Company name is different so it does not inherit
Email 🔊 Master 🔗 Inherit 🔗 Inherit
Phone 🔊 Master 🔗 Inherit 🔗 Inherit 🔗 Inherit
Address 🔊 Master 🔗 Inherit 🔗 Inherit
Salutation 🔊 Master 🔗 Inherit 🔗 Inherit
Relationship 🚫 Own Field

How Does Composition Relate to Inheritance

Note

Inheritance is a basic concept where a master definition is used to create a new object which is a variation of the master. Basically an inheriting definition can only add properties, but not remove or change them.

Composition on the other hand is much more flexible.

  1. You can inherit only a sub-set of fields from any master.
  2. You can inherit fields from multiple masters.
  3. You can inherit fields from masters and then add more fields.
  4. You can inherit some fields, but specifically implement certain fields yourself, for example when the Name on Company above should have a different description.
Note

The "downside" of composition is that inheriting definitions must specify which fields they inherit. So adding fields to the master does not automatically add it to any children. This is a good thing, but you must be aware of it.

Important Things to Know

Tip

Content-Type Composition is a great way to standardize and improve your Content-Type definitions. Any changes to the master fields will automatically be applied to all inheriting fields.

Warning

Inheriting a field will only inherit it's definition, which includes label, description, dropdown values etc. The name of the field is not inherited, so you can specify a different name in the inheriting Content-Type. This provides some flexibility, but if you rename the master, it will not automatically rename the inheriting fields.

Note

Content-Type Composition is an advanced feature which is reserved to our patrons. If you don't have the feature enabled/licensed, it will still work, but show a license warning.

But it can be a great solution to save time and streamline your work, so please look into sponsoring us. ➡️ See 2sxc Patrons Website

How to Use Content-Type Composition

Not every field is suitable for composition. Because of this, you must explicitly specify which fields are shared. This makes it easier for you to understand which fields are shared and which are not.

1. Share Fields

To share a field, you must specify that it is shared. Follow these instructions: