Override the default behavior when plug-ins are loaded

Namespace:  EPiServer.PlugIn
Assembly:  EPiServer (in EPiServer.dll) Version: 6.0.530.0

Syntax

C#
public interface ICustomPlugInLoader

Remarks

This class may be useful when a single plug-in need to generate multiple items or no items at all depending on custom conditions.

Examples

The following sample shows how to determine if a plugin should be visible by implementing the ICustomPlugInLoader interface. The plugin will only be shown to users in the Administrators group.
CopyC#
public class PageUtilPlugin : UserControlBase, ICustomPlugInLoader
{

    // implement the ICustomPlugInLoader.List method
    public PlugInDescriptor[] List()
    {
        PlugInDescriptor[] descriptors = null;

        // Check if we should show the plugin
        if (Page.User.IsInRole("Administrators"))
        {
            descriptors = new PlugInDescriptor[1];
            descriptors[0] = PlugInDescriptor.Load(this.GetType());
        }
        // else return null
        return descriptors;
    }
}

See Also