Thursday, December 28, 2017

Alchemy | What do you want to extend ?

In one of my previous blogs, I talked about the Five Basic Things you should know before developing a Alchemy Plugin. One of the most important thing listed there is, "What do you want to extend?" in Tridion GUI. The answer to this question would lead you to the Classes in Alchemy Framework,
you would have to extend in the plugin code. You can term them as Extension Points as well.

Tridion provides some extension points/areas out of the box. In Alchemy Framework you would get all those extension points as Base Classes, you simply need to extend those classes according to your plugin need. Let's talk about the Extension Points one by one.

1. Context Menu Extension:

A Context Menu appears once a user right clicks on a Item in Tridion GUI. So if you want to add an entry in the Context Menu, you would have to extend "ContextMenuExtension" class in your plugin code.
Title Translator plugin is a really good example of Context Menu Extension, The code for the plugin can be found here.

2. Command Extension:

Tridion's Anguilla Framework exposes many commands like Open, Save, Localize etc. Which are executed on respective events in the GUI. If you want to override the behavior of a command, all you need is to extend "CommandExtension" class in your plugin's code.
For example, if you want to perform some action when user saves an item, you would need to create a Alchemy Plugin by extending the class "CommandExtension".

We have a Plugin named Localize Commenter which extends this extension point, where a custom popup appears when a "Localize" command is executed.  The code for the plugin could be found here for reference.

3. Extended Area Extension:

Extended Area Extension
If your requirement is to extend a existing view, you might want to have a look at the extended areas extensibility. For example, if someone wants to add a additional check in fields details in schema design, you might need to create a plugin extending "ExtendedAreaExtension" class. I don't have any real plugin for reference, so attaching the image to give you an idea.

4. Extension Group:

So, if you don't find a suitable extension point for your plugin idea or requirement. The Extension Group extension could be your best bet. Basically this extension allows you to add your custom resources (JS, CSS, Images etc) to the different views in the GUI. These resources can then interact with the HTML and Tridion UI Core (using Anguilla framework) to produce desired results.

One good example of this type of plugin is Publication Panel Search. It places a search box above the Publication List in the left-hand panel. Users can simply start typing into the text box and Publications with the title containing the entered text will be filtered. The full code for the plugin can be referenced from here.

5. Ribbon Toolbar Extension:

As it's name suggests, this extension point is to extend the Ribbon Toolbar at the top. With this one can add buttons and manage groups in the toolbar. To achieve this all you need to extend the "RibbonToolbarExtension" class and use it's members accordingly, while coding the plugin.

There are many plugins of this type available on the Alchemy Web Store, one easy pick could be Go To Location. This plugin adds a Ribbon Tool Bar Button 'Go To Location' to the Repository Local Item views, on clicking the button user is redirected to the location of the item. The code for this plugin can be found here.

6. Tab Page Extension:

If a Tridion item is opened in explorer, there would be tabs like General, Source, Info etc. To add a custom tab to the view, in the plugin's code one has to extend the class "TabPageExtension" and use it's members accordingly.

There is again this plugin Localize Commenter which extends this extension point. The plugin adds a tab "Localize Comments" in the item's view, where localize comments can be viewed and edited. The code for the plugin can be found here for reference.

No comments:

Post a Comment