Creating or extending an item type in the Model

Extend a Content Manager item type in your custom Model to add new functionality to an existing type of item.

Procedure

  1. Create a new JavaScript file with the following content:
    Type.RegisterNamespace("MyCustomModel");
    
    MyCustomModel.SomeItemType = function MyCustomModel$SomeItemType(id)
    {
    	Tridion.OO.EnableInterface(this, "MyCustomModel.SomeItemType");
    	this.addInterface("Tridion.ContentManager.SomeItemType, [id]);
    };

    where MyCustomModel is the namespace in which your Model resides, and SomeItemType is a type of Content Manager item, such as "Publication".

    You can also create a new item type from scratch.

  2. Now add prototypes to the class to implement custom behavior for this item type. The code of your prototype can call your custom Web service(s).
  3. Save and close your JavaScript file.
  4. Add the JavaScript to a new resource group in the configuration of your Model (its own if it has one, or the Editor's configuration file):
    <cfg:group name="MyCustomModelItemTypeExtensions">
    	<cfg:fileset>
    		<cfg:file type="script">/PathTo/MyNewItemType.js</cfg:file>
    	</cfg:fileset>
    	<cfg:dependencies>
    		<cfg:dependency>Tridion.ContentManager.R5.Implementation</cfg:dependency>
    	</cfg:dependencies>
    </cfg:group>

    where /PathTo/MyNewItemType.js is the relative path and filename of the JavaScript you created, and the <cfg:dependencies> section is only required if you are extending an existing item type, not if you create a completely new item type.

  5. Save and close your configuration file.

Results

You now have a custom item type that can call your Web service(s). If you have set up your Model as a standalone software component, calling these item types, rather than calling the Web service(s) directly, from your GUI commands is recommended to keep your Model and your actual GUI extensions separate.