Studio

HOWTO: Reference an External Document Type

Updated: December 16, 2024

Some of the features of Studio rely on displaying a list of existing document types. For instance, that is the case when:

  • you configure a user action filter,
  • you use the content-template feature (you choose the type of node you add),
  • you configure the containment rules in the types definition.

That list of available document types is made from some pre-declared built-in types (Workspace, Folder, File, ...) and the ones created in Studio.

It happens that you don't find in that list the type you are looking for, mainly because:

  • We forgot to add some built-in types (at the time this page is created it is the case of Forum, Website, MailFolder, ...);
  • You have deployed on your application some packages that contributes new document types, externally from Studio.

Fortunately we added a way to extend the list of available types, using the "Registries".

What you need to do to declare a missing document type is insert a JSON declaration (written by yourself) in the Registries, that will provide the following information on the document type:

  • parent,
  • schemas,
  • facets,
  • subtypes,
  • actions.

Note that the information given in the JSON declaration are used only by Studio, to complete its user interface: it has no influence at all on the package/plugin generated by Studio or, as a consequence, on the behavior of your application. As a direct corollary, it is not mandatory to give the exhaustive information on actions, schemas, facets, subtypes, ... Only those required by what you need in the Studio interface.

Below are step-by-step instructions.

To declare a missing document type in Studio: Here, we want to add the "Forum" in the built-in types of the content-template feature, and in the container list.

  1. Click on Settings, at the bottom of the left column by default.
  2. Click on Registries to unfold the Registries menu.
  3. Click on Document Types to add a missing document type.
  4. Copy-paste the example provided in Studio.
  5. Change the ID "MyFile" by "Forum" and edit the information so you get this:

    {
    doctypes: {
    Forum: {
          parent: "Document",
          schemas: ["dummy_schema"],
          facets: [],
          subtypes: [],
          actions: []
       }
    }
    }
    
    
  6. Click on the Save button. The immediate effect will be to add "Forum" in all the lists, which might be enough for our use case.

If you want to use the type registry to inherit from an external type, you will have to give the exact schemas and the exact facets as they are inherited.

If you want to edit some layouts (forms) on properties declared in existing externally defined schemas, you will have to contribute schemas in registries.