Global Content-Types (⚠)
This explains Global Content-Types. For an overview check out Understanding Data....
This is a very advanced topic which less than 1% of all developers use.
You almost certainly will not need this. So if you start playing around with this, make sure that you really need this.
What is a Global Content-Type?
Global Content Types are a Content Types which are defined in a central location and available in all Apps of your system.
- These are custom Content-Types which are treated like System Content-Types.
- They can be used inside every single App
- The App data is in the export/import, but not the Content-Type Definition.
- If you import an App with such data, the Global Type must be configured first.
- These Content-Types are stored in the file system
For most scenarios you don't want to use this.
How it works
- Global Content-Type are stored in special folders as JSON files and are loaded by the system when it starts. From then on they are automatically available in all apps for use.
- Since the schema is not stored in the SQL database, the Entities cannot use the normal storage system. Instead they are stored as JSON Entities in the SQL tables.
Why does this Feature exist?
2sxc uses this concept for all the internal Content-Types. So any time you edit Field-settings or Visual-Query configurations, they use Global Content-Types.
We also have some really sophisticated solutions which use this feature.
Why would you want to use this?
- If you are creating a complex system with many portals and apps which should share the schema
Why would you not want to do this?
- If you only want to share the Content-Type across 2-3 Apps, you should prefer App Shared Types instead
- If you have one specific App (like News) which is installed on many Sites you should prefer App Shared Types instead
Since the data for the Global Content-Types is stored as JSON Entities there are a few drawbacks you should be aware of:
- If you plan on using the raw SQL data (not recommended anyhow) then the JSON format used in Global Content-Types adds quite a lot of complexity.
- If you ever rename fields in the Global Content-Type, the stored data will not follow the rename. From the systems perspective it has lost the old field and gotten a new one.
Create a Global Content-Type
Assume you really want to do this, here's how:
- Create the Content-Type in the normal way
- Export the Content-Type Definition as JSON
- Store it in your global custom folder (you may need to create these folders)
- In Dnn:
- In Oqtane: TODO
- In Dnn:
- Restart the system
You should now have this Content-Type show up in every App.
Update a Global Content-Type
- Make the updates in the original system
- Re-export the JSON
- Overwrite the original file
- Restart your system
Delete a Global Content-Type
- Remove the JSON file
- Restart the system
From our experience the main use case for Global Content-Types is very technical, so the content-editor usually doesn't need to see this. So we strongly recommend placing it in an own Scope.
- Introduced in 2sxc 9.7