IScriptedContentFragmentExtension represents a Telligent Evolution plugin that supports exposing a static API to scripted widget scripts. Its full type name is Telligent.Evolution.Extensibility.UI.Version1.IScriptedContentFragmentExtension and it exists within the Telligent.Evolution.ScriptedContentFragments assembly. In addition to the base IPlugin members, IScriptedContentFragmentExtension adds the following:
string ExtensionName { get; }
This property should return the name of the extension. This is the name by which scripted widgets will interact with the extension. For example, the core $core_v2_blog extension's name is "core_v2_blog".
object Extension { get; }
This property should return the object representing the API to make available via the provided ExtensionName. Any public properties and methods exposed by the object returned by the Extension property will be available to scripted widgets. Note that Velocity (the scripted engine used by scripted widgets) works best with simple data types and IDictionarys.
Once an IScriptedContentFragmentExtension is implemented and deployed to the bin/ folder of a Telligent Evolution site, it must be enabled within the Plugin Management area of the Control Panel before it is available to scripted widgets.
Example
The following exposes a custom class, Foo, via an IScriptedContentFragmentExtension, allowing a call like $company_foo.SayHello("Name") from Velocity.
public class Foo
{
public string SayHello(string name)
{
return "Hello " + name;
}
}
public class FooExtension : IScriptedContentFragmentExtension
{
public string ExtensionName { get { return "company_foo"; } }
//return an instace of the object you want exposed.
public object Extension { get { return new Foo(); } }
public string Name
{
get { return "Foo Extension”; }
}
public string Description
{
get { return "Enables scripted content fragments to use Foo."; }
}
public void Initialize()
{
}
}