Advanced Configuration Using ExtraArgs
From developer.newsgator.com
Overview
If you have a widget that you'd like to use as a template and pass arguments into it at runtime, you can use the ExtraArgs feature. An example of this would be a cobranded widget, where you let users set a header color and logo. This information can be passed into a widget as it renders on a page and doesn't need to be specified ahead of time in Editor's Desk.
How to set it up
Suppose the arguments that will be passed into the widget will be headerColor and ngLogo. In the widget HTML, you can reference them like so:
<img src="${ExtraArgs.ngLogo}" />
<div style="background-color:${ExtraArgs.headerColor}">
As a best practice you should always ensure that that exist before referencing them:
{if (ExtraArgs.ngLogo && ExtraArgs.ngLogo.length > 0)}
<img src="${ExtraArgs.ngLogo}" />
{/if}
<div "{if ExtraArgs.headerColor && ExtraArgs.headerColor.length > 0} style="background-color:${ExtraArgs.headerColor}"{/if}>
The widget script block
The arguments are passed into the widget in the script block. So as the widget is rendered you can pass arguments to it like so:
<script src="http://nmp.newsgator.com/NGBuzz/buzz.ashx?buzzId=123456&apiToken=9999999999 &headerColor=f3f3f3&ngLogo=http%3A%2F%2Fwww.newsgator.com%2Fimages%2Fim_logo.gif" type="text/javascript"></script>
All arguments must be URI encoded. Here's a handy converter: http://andrewu.co.uk/tools/uriencoder/
