Grouping plugins can make setup and configuration of your project more manageable using the IPluginGroup plugin type. This will allow you to organize and create multiple plugins and group them in the administration UI.
Why should I group plugins?
In general, multiple plugin types can be implemented via a single plugin, however, sometimes multiple plugins types should be enabled together--for example, when defining multiple scripting extensions, activity story types, a content type and an application type when implementing a fully integrated custom application. In that situation (when multiple plugins should be enabled together and/or depend on each other), a plugin group can be used.
Creating a Group Plugin
The IPluginGroup interface only has one property called Plugins. It returns a list of types to be grouped. In this sample there are three simple classes that implement IPlugin , these are grouped by the IPluginGroup interface.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telligent.Evolution.Extensibility.Version1;
namespace Samples
{
public class MyGroupPlugin : IPluginGroup
{
public string Name
{
get { return "My Group Plugin"; }
}
public string Description
{
get { return "This plugin will demo how IPluginGroup works"; }
}
public void Initialize()
{
//No initialization required for IPluginGroup
}
public IEnumerable<Type> Plugins
{
get
{
return new[]
{
typeof (MyPluginOne),
typeof (MyPluginTwo),
typeof (MyPluginThree)
};
}
}
}
public class MyPluginOne : IPlugin
{
public string Name
{
get { return "Plugin One"; }
}
public string Description
{
get { return "Part 1 of 3 for test plugin group"; }
}
public void Initialize() { }
}
public class MyPluginTwo : IPlugin
{
public string Name
{
get { return "Plugin Two"; }
}
public string Description
{
get { return "Part 2 of 3 for test plugin group"; }
}
public void Initialize() { }
}
public class MyPluginThree : IPlugin
{
public string Name
{
get { return "Plugin Three"; }
}
public string Description
{
get { return "Part 3 of 3 for test plugin group"; }
}
public void Initialize() { }
}
}
Here is how the Group Plugin is displayed in the UI.
When grouped, listed plugins in the group can only be enabled along with the group which also enables all other plugins defined by the group. This enabled groups of plugins to be enabled/disabled as a single selection.
