Set virtual nodes in the Breadcrumb widget
The IBreadcrumExtender interface allows you to add additional nodes at the end of the current sitemap path through the widgets on the page. The scenario that it is implemented for is to display the Title of the content item that is loaded in DetailsMode in the ContentView widget, as a part of the breadcrumb. You can use it in any custom control, in order to add additional nodes to the current sitemap path. When used in custom widgets, the widget must register an object of type IBreadcrumbExtender in the current page using RegisterBreadcrumbExtender extension method declared in the Telerik.Sitefinity.Web namespace.
NOTE: To see the virtual nodes in the breadcrumb widget, you must set its AllowVirtualNodes property to true. For more information about the Breadcrumb widget, read Breadcrumb widget.
To extend your custom control with this functionality, you must perform the following:
- Implement the IBreadcrumExtender interface.
The interface can be found in the Telerik.Sitefinity.Web namespace.
- Implement the GetVirtualNodes method.
The GetVirtualNodes method returns the virtual nodes that you want to append to the sitemap path. To create them, you must perform the following:
- Create an empty list.
Create a List of SiteMapNode objects.
- Create a sitemap node.
Create an instance of the SiteMapNode class.
- Add the node to the list.
Add the instance of the SiteMapNode to the list that was created in step 1.
- Return the list.
Return the list of sitemap nodes.
- Override the OnPreRender method of your widget.
In the override, call the RegisterBreadcrumbExtender method of the System.Web.UI.Page instance and pass the instance of your widget as an argument.
Use the following code sample of IBreadcrumExtender implementation: