using System; using System.Collections.Generic; using System.Linq; using Telligent.Evolution.Extensibility.Api.Version1; using Telligent.Evolution.Extensibility.UI.Version1; using Telligent.Evolution.Extensibility.Version1; namespace Samples { public class BlogExampleWidgetContext : IScriptedContentFragmentContextProvider { private readonly Guid BlogExampleContextItemId = new Guid("dd61aa2a-2595-4ced-a851-0871502911a0"); IEnumerable IScriptedContentFragmentContextProvider.GetSupportedContextItems() { return new List() { new ContextItem("Blog Example", BlogExampleContextItemId) }; } bool IScriptedContentFragmentContextProvider.HasContextItem(System.Web.UI.Page page, Guid contextItemId) { return contextItemId == BlogExampleContextItemId && PublicApi.Url.CurrentContext != null && PublicApi.Url.CurrentContext.ContextItems.GetAllContextItems() .Any(item => item.ContentTypeId == PublicApi.Blogs.ApplicationTypeId); } string IPlugin.Description { get { return "Enables studio widgets to be limited to pages with an Blog Application in context"; } } void IPlugin.Initialize() { } string IPlugin.Name { get { return "Blog Example Widget Context"; } } } }