Introduction
The following example shows how to create a component that plugs in to the assets
panel of the CMS home view:
CopyC#
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:
CopyJavaScript
define([
"dojo/_base/declare",
"dojo/html",
"dijit/_TemplatedMixin",
"dijit/_WidgetBase",
"epi/cms/_ContentContextMixin",
], function (
declare,
html,
_TemplatedMixin,
_WidgetBase,
_ContentContextMixin
) {
return declare("alloy.components.CustomComponent",
[_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.