Hi, I'm Rhys, and this is the first in a series of videos showing how to build a real extension for Telligent Community.
In this video we'll look at building a simple plugin, with some required configuration.
Plugins are one of the most common ways of extending the Telligent platform, and are .NET classes implementing the IPlugin interface.
There are many other interfaces you can inherit for extending certain parts of the platform, and we'll see a few more of these as we build the plugin.
The plugin we'll build during this series will allow users to automatically insert pre-defined content into the rich text editor, and manage this content. Each video will look at a different concept, and build up the extension as we go.
The first thing you need to do when creating a Plugin, is create a .NET class library to place it in. I'm using .NET 4.5.2 for backward compatibility with older versions of Telligent. If you are supporting Telligent 10 or newer only you should use .NET 4.6.2.
To create the plugin we will need to reference some Telligent DLLs, I'm going to start off referencing:
If you are creating a plugin for Telligent 10 or above only, you need to reference Telligent.Evolution.Platform.dll instead.
Let's create a new class for our plugin, and implement the IPlugin interface. This is a fairly straightforward interface, and I only need to specify a Name and a description.
To check it in Telligent I just need to build the project and copy the DLL created to my Telligent website bin folder. When deploying plugins you will need to make sure the DLL is copied to the bin folder of your website and the Job Service folder to avoid any mismatches or problems.
If the plugin has been copied correctly, I can login to my site as an admin, and go to the Extensions page in the administration area, in early versions of Telligent this was called Manage Plugins instead.
My plugin should be listed here, clicking on it should show me more details, and I can enable it by clicking the checkbox and then hitting Save.
Our plugin will allow users to insert a pre-defined text block into the editor. A simple way to allow this to be managed is by using plugin configuration.
This allows you to store some data at the plugin level, which you can use elsewhere in your code.
Configuration can be defined by implementing another interface - IConfigurablePlugin To use this you will need to add references to Telligent.DynamicConfiguration.dll, as we want to use the Rich text editor for our configuration we also need to add a reference to Telligent.Evolution.Controls.dll.
This requires us to implement one method and one property.
The property is where you define the configuration you require. Configuration is defined as a set of Property Groups, each of which is displayed a separate tab in the admin interface. Each property group contains one or more properties.
This also applies to other places in the Telligent platform where configuration can be used such as custom widgets.
For this plugin, I want users to be able to supply some HTML that we can then use as the template later on, so I'm going to add one property group named Configuration, and a single property named Template.
The property will be a HTML type, and as I want the user to have a Rich Text Editor to enter this I also need to set the Control of the property to use the Rich Text Editor.
The method we need to implement is called whenever the plugin is loaded, for example when the website starts up, or when the user saves any changes to the configuration.
The normal pattern for this is to have a static class, which contains the configuration values, when this method is called the data in the static class is updated. Other plugins and your code can then call this. We'll create a new static class called ContentTemplateConfiguration with one property called Template.
When the Update method is called we'll use the GetHtml method to get the value and store it in our static class.
Again, we can copy the DLL over to our Telligent website, and reload the Plugin page, now we see the configuration option and a Rich Text Editor we can use to enter the template.
In this video we've taken a look at how to create the most basic plugin in Telligent and define some configuration for it, in the next couple of videos we'll explore some more core concepts such as translation and then build on this to make our plugin do something useful!