Extend a Content Manager item type in your custom Model to add new functionality to an existing type of item.
Procedure
- 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.
- 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).
- Save and close your JavaScript file.
- 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.
- 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.