Content Peek - Change the content that renders in the popup

Is it possible to alter the content that appears in the popup of the new peekable content?

Parents Reply
  • You will need to create your own private widget API.  See the section on Defining private widget APIs in Using Widgets to Render Content From Plugins .

    When you are rendering your widget in the GetViewHtml, you can pass the contentId and contentTypeId into the widget and the private api can use those to populate the Content object:

    return WidgetController.RenderContent(_peekableContentFragmentId, new NameValueCollection
    {
    ["contentTypeId"] = content.ContentTypeId.ToString(),
    ["contentId"] = content.ContentId.ToString(),
    ["target"] = target.ToString()
    });

    Your private API would look something like this:

    		public class PanelContext : IContextualScriptedContentFragmentExtension
    		{
    			public string ExtensionName
    			{
    				get { return "context"; }
    			}
    
    			public object GetExtension(NameValueCollection context)
    			{
    				Guid contentId;
    				Guid contentTypeId;
    
    				if (!Guid.TryParse(context["contentId"], out contentId))
    					contentId = Guid.Empty;
    
    				if (!Guid.TryParse(context["contentTypeId"], out contentTypeId))
    					contentTypeId = Guid.Empty;
    
    				return new PanelContextApi(contentId, contentTypeId, context["target"] ?? "Web");
    			}
    		}
    
    		public class PanelContextApi
    		{
    			public PanelContextApi(Guid contentId, Guid contentTypeId, string target)
    			{
    				Content = Telligent.Evolution.Extensibility.Apis.Get<IContents>().Get(contentId, contentTypeId);
    				Target = target;
    			}
    
    			public Telligent.Evolution.Extensibility.Api.Entities.Version1.Content Content { get; }
    			public string Target { get; }
    		}

Children