<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Widget Extensions</title><link>https://community.telligent.com/community/11/w/developer-training/65065/widget-extensions</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>Widget Extensions</title><link>https://community.telligent.com/community/11/w/developer-training/65065/widget-extensions</link><pubDate>Wed, 05 Aug 2020 15:11:47 GMT</pubDate><guid isPermaLink="false">41313560-980b-44ae-a88c-fb53fe7ab160</guid><dc:creator>Former Member</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/65065/widget-extensions#comments</comments><description>Current Revision posted to Developer Training by Former Member on 08/05/2020 15:11:47&lt;br /&gt;
&lt;p&gt;Widget extensions are&amp;nbsp;plugins that support exposing APIs to [[Widgets|widgets]], [[Themes|themes]], and [[Automations|automations]]. &amp;nbsp;Documentation for the extensions that are included with Verint Community can be found at &lt;a title="Widget Extensions Documentation" href="/developers/w/developer90/50907.widget-extensions"&gt;Widget Extensions Documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p id="toc"&gt;[toc]&lt;/p&gt;
&lt;h2&gt;&lt;a id="Why_should_I_create_a_Widget_Extension" name="Why_should_I_create_a_Widget_Extension"&gt;&lt;/a&gt;Why should I create a Widget Extension?&lt;/h2&gt;
&lt;p&gt;Do you have any custom methods or properties you want to be able to call directly from a widget? &amp;nbsp;A custom widget extension can expose these methods and properties so they can be called directly in velocity scripts.&lt;/p&gt;
&lt;h2 id="iscriptedContentFragmentExtension_interface"&gt;&lt;a name="IScriptedContentFragmentExtension_Interface"&gt;&lt;/a&gt;Creating a Widget&amp;nbsp;Extension&lt;/h2&gt;
&lt;p&gt;First we need a class with one or more public methods or properties that we want to expose in our widget extension. &amp;nbsp;Velocity (the script engine used by scripted widgets) works best with simple data types and IDictionarys.&lt;/p&gt;
&lt;p&gt;The following class has a single public method named Hello. &amp;nbsp;The method takes a single string parameter name and return &amp;quot;Hello {name}&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;    public class Sample 
    {
        public string SayHello(string name) 
        {
            return &amp;quot;Hello &amp;quot; + name;
        }
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In order to expose this class we will use a second class that implements the&amp;nbsp;&lt;a title="IScriptedContentFragmentExtension" href="/developers/w/developer90/50321.iscriptedcontentfragmentextension-plugin-type"&gt;IScriptedContentFragmentExtension&lt;/a&gt;&amp;nbsp;Plugin type.&amp;nbsp;First we return&amp;nbsp;an instance of our Sample class to the Extension method.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;public object Extension
{
    get { return new Sample(); }
}&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We also need to provide a unique name for the sample extension. &amp;nbsp;For the example we will use the name &amp;quot;telligent_v1_samples&amp;quot;. &amp;nbsp;We recommend using&amp;nbsp;{vendor}_v{version_number}_{service_name} when naming your widget extensions to ensure the extensions are named uniquely, easily versioned and remain consistent with existing extensions.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;public string ExtensionName
{
    get { return &amp;quot;telligent_v1_samples&amp;quot;; }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Once an&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;IScriptedContentFragmentExtension &lt;/span&gt;is implemented and deployed to the bin/ folder of a Verint Community site, it must be enabled within the Administration area&amp;nbsp;before it is available to scripted widgets. To enable, navigate to Administration &amp;gt; Interface &amp;gt; Widget APIs and search for the name of your extension. Alternatively, you can try searching for your extension&amp;#39;s name via the Search box in the upper-left of the Administration panel. Note: If your extension doesn&amp;#39;t show up, try recycling your Community&amp;#39;s application pool in IIS.&lt;/p&gt;
&lt;h2&gt;&lt;a name="Example"&gt;&lt;/a&gt;Sample&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;The completed source code for the sample extension:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://community.telligent.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-12-83/3247_2E00_SampleWidgetExtension_2E00_cs"&gt;community.telligent.com/.../3247_2E00_SampleWidgetExtension_2E00_cs&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a id="Using_the_Extension" name="Using_the_Extension"&gt;&lt;/a&gt;Using the Extension&lt;/h2&gt;
&lt;p&gt;Now that our extension is enabled, we can create a widget that calls our extension:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="velocity"&gt;$telligent_v1_samples.SayHello(&amp;#39;World&amp;#39;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Add this widget to a page and you should see widget output &amp;quot;Hello World&amp;quot;. &amp;nbsp;If the call to the widget extension had thrown an exception, the widget would not be rendered for the end user. &amp;nbsp;While editing the page you would see the exception rendered instead of the expected widget contents. &amp;nbsp;Error messages may also be returned the response, to provide translatable or easier to understand error messages. &amp;nbsp;Returning a value that uses or inherits one of&amp;nbsp;following types (&lt;a href="/developers/w/developer90/50118.apilist-t-plugin-supplementary-type"&gt;ApiList&lt;/a&gt;, &lt;a href="/developers/w/developer90/49516.pagedlist-t-in-process-api-supplementary-type"&gt;PagedList&lt;/a&gt;, ApiEntity or &lt;a href="/developers/w/developer90/49311.additionalinfo-in-process-api-supplementary-type"&gt;AdditionalInfo&lt;/a&gt;) facilitates the return of errors by providing an Errors collection property on the return object.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: IScriptedContentFragmentExtension&lt;/div&gt;
</description></item><item><title>Widget Extensions</title><link>https://community.telligent.com/community/11/w/developer-training/65065/widget-extensions/revision/2</link><pubDate>Fri, 21 Jun 2019 19:02:39 GMT</pubDate><guid isPermaLink="false">41313560-980b-44ae-a88c-fb53fe7ab160</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/65065/widget-extensions#comments</comments><description>Revision 2 posted to Developer Training by Ben Tiedt on 06/21/2019 19:02:39&lt;br /&gt;
&lt;p&gt;Widget extensions are&amp;nbsp;plugins that support exposing APIs to [[Widgets|widgets]], [[Themes|themes]], and [[Automations|automations]]. &amp;nbsp;Documentation for the extensions that are included with Telligent Community can be found at &lt;a title="Widget Extensions Documentation" href="/developers/w/developer90/50907.widget-extensions"&gt;Widget Extensions Documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p id="toc"&gt;[toc]&lt;/p&gt;
&lt;h2&gt;&lt;a id="Why_should_I_create_a_Widget_Extension" name="Why_should_I_create_a_Widget_Extension"&gt;&lt;/a&gt;Why should I create a Widget Extension?&lt;/h2&gt;
&lt;p&gt;Do you have any custom methods or properties you want to be able to call directly from a widget? &amp;nbsp;A custom widget extension can expose these methods and properties so they can be called directly in velocity scripts.&lt;/p&gt;
&lt;h2 id="iscriptedContentFragmentExtension_interface"&gt;&lt;a name="IScriptedContentFragmentExtension_Interface"&gt;&lt;/a&gt;Creating a Widget&amp;nbsp;Extension&lt;/h2&gt;
&lt;p&gt;First we need a class with one or more public methods or properties that we want to expose in our widget extension. &amp;nbsp;Velocity (the script engine used by scripted widgets) works best with simple data types and IDictionarys.&lt;/p&gt;
&lt;p&gt;The following class has a single public method named Hello. &amp;nbsp;The method takes a single string parameter name and return &amp;quot;Hello {name}&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;    public class Sample 
    {
        public string SayHello(string name) 
        {
            return &amp;quot;Hello &amp;quot; + name;
        }
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In order to expose this class we will use a second class that implements the&amp;nbsp;&lt;a title="IScriptedContentFragmentExtension" href="/developers/w/developer90/50321.iscriptedcontentfragmentextension-plugin-type"&gt;IScriptedContentFragmentExtension&lt;/a&gt;&amp;nbsp;Plugin type.&amp;nbsp;First we return&amp;nbsp;an instance of our Sample class to the Extension method.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;public object Extension
{
    get { return new Sample(); }
}&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We also need to provide a unique name for the sample extension. &amp;nbsp;For the example we will use the name &amp;quot;telligent_v1_samples&amp;quot;. &amp;nbsp;We recommend using&amp;nbsp;{vendor}_v{version_number}_{service_name} when naming your widget extensions to ensure the extensions are named uniquely, easily versioned and remain consistent with existing extensions.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;public string ExtensionName
{
    get { return &amp;quot;telligent_v1_samples&amp;quot;; }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Once an&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;IScriptedContentFragmentExtension &lt;/span&gt;is implemented and deployed to the bin/ folder of a Telligent Community site, it must be enabled within the Administration area&amp;nbsp;before it is available to scripted widgets. To enable, navigate to Administration &amp;gt; Interface &amp;gt; Widget APIs and search for the name of your extension. Alternatively, you can try searching for your extension&amp;#39;s name via the Search box in the upper-left of the Administration panel. Note: If your extension doesn&amp;#39;t show up, try recycling your Community&amp;#39;s application pool in IIS.&lt;/p&gt;
&lt;h2&gt;&lt;a name="Example"&gt;&lt;/a&gt;Sample&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;The completed source code for the sample extension:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://community.telligent.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-12-83/3247_2E00_SampleWidgetExtension_2E00_cs"&gt;community.telligent.com/.../3247_2E00_SampleWidgetExtension_2E00_cs&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a id="Using_the_Extension" name="Using_the_Extension"&gt;&lt;/a&gt;Using the Extension&lt;/h2&gt;
&lt;p&gt;Now that our extension is enabled, we can create a widget that calls our extension:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="velocity"&gt;$telligent_v1_samples.SayHello(&amp;#39;World&amp;#39;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Add this widget to a page and you should see widget output &amp;quot;Hello World&amp;quot;. &amp;nbsp;If the call to the widget extension had thrown an exception, the widget would not be rendered for the end user. &amp;nbsp;While editing the page you would see the exception rendered instead of the expected widget contents. &amp;nbsp;Error messages may also be returned the response, to provide translatable or easier to understand error messages. &amp;nbsp;Returning a value that uses or inherits one of&amp;nbsp;following types (&lt;a href="/developers/w/developer90/50118.apilist-t-plugin-supplementary-type"&gt;ApiList&lt;/a&gt;, &lt;a href="/developers/w/developer90/49516.pagedlist-t-in-process-api-supplementary-type"&gt;PagedList&lt;/a&gt;, ApiEntity or &lt;a href="/developers/w/developer90/49311.additionalinfo-in-process-api-supplementary-type"&gt;AdditionalInfo&lt;/a&gt;) facilitates the return of errors by providing an Errors collection property on the return object.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: IScriptedContentFragmentExtension&lt;/div&gt;
</description></item><item><title>Widget Extensions</title><link>https://community.telligent.com/community/11/w/developer-training/65065/widget-extensions/revision/1</link><pubDate>Fri, 14 Jun 2019 17:08:21 GMT</pubDate><guid isPermaLink="false">41313560-980b-44ae-a88c-fb53fe7ab160</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/65065/widget-extensions#comments</comments><description>Revision 1 posted to Developer Training by Ben Tiedt on 06/14/2019 17:08:21&lt;br /&gt;
&lt;p&gt;Widget extensions are&amp;nbsp;plugins that support exposing APIs to widgets. &amp;nbsp;Documentation for the extensions that are included with Telligent Community can be found at &lt;a title="Widget Extensions Documentation" href="/developers/w/developer90/50907.widget-extensions"&gt;Widget Extensions Documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p id="toc"&gt;[toc]&lt;/p&gt;
&lt;h2&gt;&lt;a id="Why_should_I_create_a_Widget_Extension" name="Why_should_I_create_a_Widget_Extension"&gt;&lt;/a&gt;Why should I create a Widget Extension?&lt;/h2&gt;
&lt;p&gt;Do you have any custom methods or properties you want to be able to call directly from a widget? &amp;nbsp;A custom widget extension can expose these methods and properties so they can be called directly in velocity scripts.&lt;/p&gt;
&lt;h2 id="iscriptedContentFragmentExtension_interface"&gt;&lt;a name="IScriptedContentFragmentExtension_Interface"&gt;&lt;/a&gt;Creating a Widget&amp;nbsp;Extension&lt;/h2&gt;
&lt;p&gt;First we need a class with one or more public methods or properties that we want to expose in our widget extension. &amp;nbsp;Velocity (the script engine used by scripted widgets) works best with simple data types and IDictionarys.&lt;/p&gt;
&lt;p&gt;The following class has a single public method named Hello. &amp;nbsp;The method takes a single string parameter name and return &amp;quot;Hello {name}&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;    public class Sample 
    {
        public string SayHello(string name) 
        {
            return &amp;quot;Hello &amp;quot; + name;
        }
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In order to expose this class we will use a second class that implements the&amp;nbsp;&lt;a title="IScriptedContentFragmentExtension" href="/developers/w/developer90/50321.iscriptedcontentfragmentextension-plugin-type"&gt;IScriptedContentFragmentExtension&lt;/a&gt;&amp;nbsp;Plugin type.&amp;nbsp;First we return&amp;nbsp;an instance of our Sample class to the Extension method.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;public object Extension
{
    get { return new Sample(); }
}&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We also need to provide a unique name for the sample extension. &amp;nbsp;For the example we will use the name &amp;quot;telligent_v1_samples&amp;quot;. &amp;nbsp;We recommend using&amp;nbsp;{vendor}_v{version_number}_{service_name} when naming your widget extensions to ensure the extensions are named uniquely, easily versioned and remain consistent with existing extensions.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;public string ExtensionName
{
    get { return &amp;quot;telligent_v1_samples&amp;quot;; }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Once an&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;IScriptedContentFragmentExtension &lt;/span&gt;is implemented and deployed to the bin/ folder of a Telligent Community site, it must be enabled within the Administration area&amp;nbsp;before it is available to scripted widgets. To enable, navigate to Administration &amp;gt; Interface &amp;gt; Widget APIs and search for the name of your extension. Alternatively, you can try searching for your extension&amp;#39;s name via the Search box in the upper-left of the Administration panel. Note: If your extension doesn&amp;#39;t show up, try recycling your Community&amp;#39;s application pool in IIS.&lt;/p&gt;
&lt;h2&gt;&lt;a name="Example"&gt;&lt;/a&gt;Sample&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;The completed source code for the sample extension:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://community.telligent.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-12-83/3247_2E00_SampleWidgetExtension_2E00_cs"&gt;community.telligent.com/.../3247_2E00_SampleWidgetExtension_2E00_cs&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a id="Using_the_Extension" name="Using_the_Extension"&gt;&lt;/a&gt;Using the Extension&lt;/h2&gt;
&lt;p&gt;Now that our extension is enabled, we can create a widget that calls our extension:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="velocity"&gt;$telligent_v1_samples.SayHello(&amp;#39;World&amp;#39;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Add this widget to a page and you should see widget output &amp;quot;Hello World&amp;quot;. &amp;nbsp;If the call to the widget extension had thrown an exception, the widget would not be rendered for the end user. &amp;nbsp;While editing the page you would see the exception rendered instead of the expected widget contents. &amp;nbsp;Error messages may also be returned the response, to provide translatable or easier to understand error messages. &amp;nbsp;Returning a value that uses or inherits one of&amp;nbsp;following types (&lt;a href="/developers/w/developer90/50118.apilist-t-plugin-supplementary-type"&gt;ApiList&lt;/a&gt;, &lt;a href="/developers/w/developer90/49516.pagedlist-t-in-process-api-supplementary-type"&gt;PagedList&lt;/a&gt;, ApiEntity or &lt;a href="/developers/w/developer90/49311.additionalinfo-in-process-api-supplementary-type"&gt;AdditionalInfo&lt;/a&gt;) facilitates the return of errors by providing an Errors collection property on the return object.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: IScriptedContentFragmentExtension&lt;/div&gt;
</description></item></channel></rss>