Last active
August 15, 2018 09:04
-
-
Save patfog/78faa1b892ede27545602aa65f15bff5 to your computer and use it in GitHub Desktop.
Episerver - minimal admin plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Mvc; | |
using System.Web.Routing; | |
using EPiServer.Framework; | |
using EPiServer.Framework.Initialization; | |
namespace Sandbox.CMS.Plugins | |
{ | |
public class InitModule : IInitializableModule | |
{ | |
public void Initialize(InitializationEngine context) | |
{ | |
// Add support for attribute routing | |
RouteTable.Routes.MapMvcAttributeRoutes(); | |
} | |
public void Uninitialize(InitializationEngine context) | |
{ | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Mvc; | |
using EPiServer.PlugIn; | |
namespace Sandbox.CMS.Plugins | |
{ | |
[GuiPlugIn( | |
Area = PlugInArea.AdminMenu, | |
Url = "/" + MyTestControllerPath, | |
DisplayName = "My Plugin")] | |
[Authorize(Roles = "CmsAdmins")] | |
[Route(MyTestControllerPath)] | |
public class MyTestController : Controller | |
{ | |
internal const string MyTestControllerPath = "custom-plugins/my-plugin"; | |
public ActionResult Index() | |
{ | |
return Content("Found"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment