I finally found some time to start working on my own plugin built in this incredible new framework developed by Content Bloom called Alchemy. You can see my plugin on the Alchemy WebstoreÂ here. It’s called Not UsedÂ and it’s really just a basic cleanup tool that allows a Tridion user to search for and remove various items that are not in use. Perhaps more interesting than the plugin itself is the process of learning to work within the Alchemy framework, which requires a combination of knowledge in Tridion’s Anguilla framework, C# core service API and standard .NET web technologies. SomeÂ of these have documentation that is seemingly hidden or otherwise very difficult to track downÂ and/or decipher. Here I discuss some of the trickier bits of my experiences developing an Alchemy plugin, in hopes that these details will help others encountering the same challenges. I’d like to give a special thanks to everyone who helped me along the way!
There is a rough HTML version of the Anguilla APIÂ floating around, but what I found to be more effective is to look directly at the existing Tridion GUI code. You can access this code in your Tridion installation atÂ C:\Program Files (x86)\Tridion\web\WebUI or another similar location. Once you locate the .js files there, you can use something like Notepad++ to search through the files to gain an understanding of how Anguilla JS code is written and find various pieces of code that you can tweak/reuse. In my case, I was looking to gain an understanding of how I can properly run the delete command in Anguilla. A quick search for deleteÂ gave me the following clues about what code I would need to delete a given unused item from Tridion:
The Alchemy documentation here shows how you can use the InsertBefore property when setting up a context menu in your Alchemy C# code to control where your menu item appears in the context menu. But other than cm_refresh, where else can you position a context menu item? Is there an exhaustive list of these constants somewhere to help you? In fact, yes, there is… sort of. Have a look in the following places:
- C:\Program Files (x86)\Tridion\web\WebUI\Editors\CME\Configuration\CME.config
I originally limitedÂ my Not Used plugin to only support searching within folders. I achieved this with the following code:
if (items.length == 1 && (item.getItemType() == 'tcm:2'))...
Note tcm:2 is a folder in Tridion. But what if I wanted to extend my plugin to allow searching within categories/keywords, for instance, to find additional unused items? What is the item type for a category? In general, how do you find an item type? A nice quick referenceÂ suggested to me is to work in the browser’s developer console and use the following commands to display a list of item types:
var Tridion = frames;
You can quickly see that a category is tcm:512!