Example
The example below shows how to create a component that plugs in to the Assets pane of the CMS home view.
C#
using EPiServer.Shell.ViewComposition;
using EPiServer.Shell.Web;
namespace CodeSamples
{
[Component(
PlugInAreas = "/episerver/cms/assets",
Categories = "cms",
WidgetType = "alloy.components.CustomComponent",
Title = "My custom component",
Description = "A custom component that shows information about the current content item.")]
public class CustomComponent { }
}
And the following is the corresponding JavaScript widget:
JavaScript
define([
"dojo/_base/declare",
"dojo/html",
"dijit/_TemplatedMixin",
"dijit/_WidgetBase",
"epi-cms/_ContentContextMixin",
], function (
declare,
html,
_TemplatedMixin,
_WidgetBase,
_ContentContextMixin
) {
return declare([_WidgetBase, _TemplatedMixin, _ContentContextMixin], {
templateString: '<div>\
<div data-dojo-attach-point="contentName"></div>\
</div>',
contextChanged: function (context, callerData) {
this.inherited(arguments);
html.set(this.contentName, context.name);
}
});
});
Do you find this information helpful? Please log in to provide feedback.