createObjClass(definition)

Creates a page or resource type for the CMS without adding it to the registry of CMS object types.

Scrivito.createObjClass generates an object class using the given definition.

Object classes serve as boilerplates for CMS objects. Their main purpose is to define the attributes the instances require, for example a string attribute named “title” or a binary attribute for binary data like an image or a PDF document.

Please note that Scrivito.createObjClass does not automatically add the generated class to the registry of CMS object types. Instead, it is considered an „abstract class“. An abstract class is useful:

  • as a superclass for specialized CMS page types and resources,
  • for overloading an API method (e. g. slug) before registering the final type using Scrivito.provideObjClass.

Params

Returns

ObjClass

Remarks

User-defined page models inherit all methods from Obj.

Example

Create a an abstract class named BaseClass and a subclass named Page: