AgentStack
SKILL verified MIT Self-run

Orchardcore Admin

skill-crestapps-crestapps-agentskills-orchardcore-admin · by CrestApps

Guidance for working with the Orchard Core admin panel, including admin controllers, menu registration, dashboard widgets, admin theme customization, settings pages, and admin-specific shapes and zones. Use this skill when requests mention Orchard Core Admin Panel, TheAdmin Theme, Admin Controllers, Admin Route URL Generation, Admin Menu Registration, Adding an Icon to an Admin Menu Item, or clos…

No reviews yet
0 installs
6 views
0.0% view→install

Install

$ agentstack add skill-crestapps-crestapps-agentskills-orchardcore-admin

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Orchardcore Admin? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Orchard Core Admin Panel

The Orchard Core admin panel is the back-office interface used for content management, site configuration, and administrative tasks. It is rendered using the TheAdmin theme, which provides a dedicated layout, navigation structure, and styling separate from the front-end site.

TheAdmin Theme

TheAdmin is the built-in administration theme that ships with Orchard Core. It defines the admin layout, sidebar navigation, header bar, and all administrative UI chrome. The theme is automatically activated for any request routed through the admin pipeline.

Key characteristics:

  • Provides the Layout shape with admin-specific zones such as Navigation, Content, Header, Footer, Messages, and DetailAdmin.
  • Uses Bootstrap-based styling with Orchard Core admin CSS.
  • Supports customization through shape overrides, zone manipulation, and theme inheritance.

The ocat-* CSS Class System

Admin editor views use static CSS classes prefixed with ocat- (Orchard Core Admin Theme) for consistent two-column layout. These classes replaced the former TheAdminThemeOptions and CssOrchardHelperExtensions (e.g., @Orchard.GetWrapperClasses()) which have been removed.

Do NOT apply these classes to frontend-facing views such as Login, Register, ForgotPassword, or any view rendered by the site theme. They are exclusively for admin (back-end) views.

Core CSS Classes

| Class | Element | Purpose | |-------|---------|---------| | ocat-wrapper | ` | Outer container for a form field row (replaces mb-3/form-group) | | ocat-label | | Styles the field label in the left column (replaces form-label) | | ocat-label-required | | Add alongside ocat-label to mark a field as required | | ocat-end | | Wraps the input, validation, and hint in the right column | | ocat-end-offset | | Right-column content with no left label (for checkboxes, headings, buttons) | | ocat-limited-wrapper | | Outer row for limited-width controls (short text, numbers, selects) | | ocat-limited | | Constrains the control width inside ocat-limited-wrapper` |

Pattern 1: Standard field (label + input)

    @T["Title"]
    
        
        
        @T["Hint text."]
    
Pattern 2: Checkbox without a separate left label

    
        
            
            @T["Enable feature"]
        
        @T["Check to enable this feature."]
    
Pattern 3: Limited-width field (narrower input column)

    @T["Default Time Zone"]
    
        
            @T["Select..."]
        
        
        @T["Hint text."]
    
Pattern 4: Section heading (pushed right to align with inputs)

    
        @T["Section Title"]
    
Pattern 5: Action buttons (submit, cancel)

    
        @T["Save"]
    
Pattern 6: Required field label

    @T["Name"]
    
        
        
    
Pattern 7: Limited-width control inside a field wrapper

Use when the editor row needs Orchard-specific wrapper classes like field-wrapper-*:


    @T["Value"]
    
        
            
                
                
            
        
        @T["Use a compact editor width while preserving the field wrapper row."]
    
Customizing the Layout via CSS

To customize the admin layout, override the ocat-* CSS classes in your custom admin theme's stylesheet. For example, to create a horizontal layout:

.ocat-wrapper {
    --ocat-gutter-x: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    margin-right: calc(-0.5 * var(--ocat-gutter-x));
    margin-left: calc(-0.5 * var(--ocat-gutter-x));
    margin-bottom: 1rem;
}
.ocat-label {
    flex: 0 0 auto;
    width: 25%;
    text-align: end;
    padding-top: calc(0.375rem + var(--bs-border-width));
}
.ocat-end {
    flex: 0 0 auto;
    width: 75%;
}
.ocat-end-offset {
    flex: 0 0 auto;
    width: 75%;
    margin-inline-start: 25%;
}
Rules for applying ocat-* classes
  1. All admin views should use ocat-* classes (including *Settings.Edit.cshtml views)
  2. Frontend views MUST NOT use ocat-* classes — Login, Register, ForgotPassword, email verification, etc.
  3. Admin Menu node editing should NOT use these classes (needs full width)
  4. Widget containers (BagPart, FlowPart, WidgetsListPart) are skipped — no standard form fields
  5. Validation spans (`) always go inside ocat-end or ocat-end-offset`
  6. Hint spans (`) always go inside ocat-end or ocat-end-offset`
  7. Checkboxes without a left label use ocat-wrapper + ocat-end-offset for the form-check div
Migration from Old Helpers

| Old Pattern | New Pattern | |-------------|-------------| | @Orchard.GetWrapperClasses() | ocat-wrapper | | @Orchard.GetLabelClasses() | ocat-label | | @Orchard.GetLabelClasses(true) | ocat-label ocat-label-required | | @Orchard.GetEndClasses() | ocat-end | | @Orchard.GetEndClasses(true) | ocat-end-offset | | @Orchard.GetLimitedWidthWrapperClasses() | ocat-limited-wrapper | | @Orchard.GetLimitedWidthClasses() | ocat-limited | | @Orchard.GetStartClasses() | (removed, use CSS override) | | @Orchard.GetOffsetClasses() | ocat-end-offset | | TheAdminTheme:StyleSettings in appsettings.json | Override ocat-* classes in custom admin theme CSS | | PostConfigure | Override ocat-* classes in custom admin theme CSS |

Admin Controllers

To create a controller that renders inside the admin panel, apply the [Admin] attribute to the controller class or individual action methods. This attribute routes the action through the admin theme and enforces authentication.

using Microsoft.AspNetCore.Mvc;
using OrchardCore.Admin;
using OrchardCore.DisplayManagement.Notify;

[Admin("MyModule/Settings/{action}", "MyModule.Settings")]
public sealed class SettingsController : Controller
{
    private readonly INotifier _notifier;

    public SettingsController(INotifier notifier)
    {
        _notifier = notifier;
    }

    public IActionResult Index()
    {
        return View();
    }

    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task Update()
    {
        await _notifier.SuccessAsync(new LocalizedHtmlString("Settings updated."));
        return RedirectToAction(nameof(Index));
    }
}

The [Admin] attribute accepts two optional parameters:

  1. Route template — defines the admin URL pattern for the controller (e.g., "MyModule/Settings/{action}").
  2. Route name — assigns a named route for URL generation (e.g., "MyModule.Settings").

When applied at the class level, all actions in the controller are treated as admin actions. You can also apply it to individual actions if only some methods should be admin-scoped.

Admin Route URL Generation

In Razor views, prefer anchor and form tag helpers so link generation stays in the view:


    @T["Open settings"]

If you need to generate an admin URL in code, prefer LinkGenerator and pass the current HttpContext:

using Microsoft.AspNetCore.Routing;

public sealed class AdminUrlService
{
    private readonly LinkGenerator _linkGenerator;

    public AdminUrlService(LinkGenerator linkGenerator)
    {
        _linkGenerator = linkGenerator;
    }

    public string? GetSettingsUrl(HttpContext httpContext)
    {
        return _linkGenerator.GetPathByAction(
            httpContext,
            action: "Index",
            controller: "Settings",
            values: new { area = "MyModule" });
    }
}

Do not use @Url.Content("~/...") for application links in Orchard Core views.

Admin Menu Registration

Admin menu items should prefer inheriting from NamedNavigationProvider for the admin menu, rather than implementing INavigationProvider directly. Each provider contributes entries to the admin sidebar navigation.

using Microsoft.Extensions.Localization;
using OrchardCore.Navigation;

internal sealed class AdminMenu : NamedNavigationProvider
{
    private readonly IStringLocalizer S;

    public AdminMenu(IStringLocalizer localizer)
        : base(NavigationConstants.AdminId)
    {
        S = localizer;
    }

    protected override ValueTask BuildAsync(NavigationBuilder builder)
    {
        builder
            .Add(S["Content Management"], content => content
                .AddClass("content-management")
                .Id("contentmanagement")
                .Add(S["Taxonomies"], S["Taxonomies"].PrefixPosition(), taxonomies => taxonomies
                    .Permission(Permissions.ManageTaxonomies)
                    .Action("Index", "Admin", new { area = "MyModule" })
                    .LocalNav()
                )
            );

        return ValueTask.CompletedTask;
    }
}

Use INavigationProvider directly only as a secondary option when you genuinely need to handle multiple menu names or custom routing logic that does not fit the named-provider pattern.

Register the provider in Startup.cs:

public sealed class Startup : StartupBase
{
    public override void ConfigureServices(IServiceCollection services)
    {
        services.AddNavigationProvider();
    }
}

Adding an Icon to an Admin Menu Item

For NamedNavigationProvider or INavigationProvider menu items, do not put Font Awesome classes on the item with AddClass(...). Instead:

  1. Assign a stable id with .Id("sports").
  2. Add a Razor view named NavigationItemText-sports.Id.cshtml.
  3. Render the icon and title from that view.

Example navigation provider:

builder.Add(S["Sports"], sports => sports
    .Id("sports")
    .Add(S["Calendar"], calendar => calendar
        .Action("Index", "Admin", new { area = "MyModule" })
        .LocalNav()
    )
);

Example view file Views/NavigationItemText-sports.Id.cshtml:


    

@Model.Text

Use this pattern when you need a custom icon for an admin navigation item rendered by TheAdmin theme.

Menu Grouping and Ordering

Menu items are organized hierarchically using nested Add calls. Use the Position method to control item order within a group. Position values are strings that support numeric sorting (e.g., "1", "2.5", "10").

The Orchard Core admin sidebar uses these top-level groups:

| Group | Purpose | |-------|---------| | Content Management | Content items, taxonomies, media | | Settings | Site settings and configuration pages | | Tools | Non-settings admin utilities (cache, import/export) | | Access Control | Users, Roles, and permissions |

builder
    .Add(S["Settings"], settings => settings
        .Add(S["Email"], email => email
            .Action("Index", "Admin", new { area = "OrchardCore.Email" })
            .Permission(Permissions.ManageEmailSettings)
            .LocalNav()
        )
        .Add(S["Search"], search => search
            .Action("Index", "Admin", new { area = "OrchardCore.Search" })
            .Permission(Permissions.ManageSearchSettings)
            .LocalNav()
        )
    );

> Important: Orchard Core no longer uses the "Configuration" or "Security" top-level menu groups. Use "Settings" for settings pages, "Tools" for non-settings utilities, and "Access Control" for user/role management.

Permission-Based Menu Visibility

Use the Permission method to restrict menu item visibility. Items are automatically hidden from users who lack the specified permission. You can chain multiple Permission calls if any one of several permissions should grant visibility.

builder
    .Add(S["Access Control"], accessControl => accessControl
        .Add(S["Users"], users => users
            .Permission(Permissions.ManageUsers)
            .Action("Index", "Admin", new { area = "OrchardCore.Users" })
            .LocalNav()
        )
        .Add(S["Roles"], roles => roles
            .Permission(Permissions.ManageRoles)
            .Action("Index", "Admin", new { area = "OrchardCore.Roles" })
            .LocalNav()
        )
    );

Admin Views and Layouts

Admin views are standard Razor views placed in the Views folder of your module. When rendered through an admin controller, they automatically use the admin layout provided by TheAdmin theme.

To create an admin view at Views/Settings/Index.cshtml:


    @T["My Module Settings"]

    
        @T["Display Name"]
        
            
            
        
    

    
        
            @T["Save"]
        
    

Admin Zones

The admin layout defines several zones for placing content:

| Zone | Purpose | |------|---------| | Title | Page title displayed at the top of the content area | | Content | Main body content | | Navigation | Sidebar navigation menu | | Header | Top bar area (user menu, site name) | | Messages | Notification and alert messages | | DetailAdmin | Secondary detail panel | | Footer | Bottom area of the admin layout | | HeadMeta | Additional ` tags in ` |

Use the `` tag helper to inject content into these zones from any admin view:


    @T["Remember to publish your changes."]

Dashboard Widgets

Dashboard widgets appear on the admin dashboard landing page. To create a dashboard widget, implement a shape and register it with the dashboard zone.

Creating a Dashboard Widget Shape

First, define a display driver for the widget:

using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.DisplayManagement.Views;
using OrchardCore.Admin;

public sealed class RecentActivityWidgetDisplayDriver : DisplayDriver
{
    public override IDisplayResult Display(DashboardCard model, BuildDisplayContext context)
    {
        return View("RecentActivityWidget", model)
            .Location("DetailAdmin", "Content:5");
    }
}

Register the driver in Startup.cs:

services.AddDisplayDriver();

Dashboard Widget View

Create Views/RecentActivityWidget.cshtml:


    
        @T["Recent Activity"]
    
    
        
            @T["3 content items published today"]
            @T["12 new users this week"]
        
    

Admin Theme Customization and Branding

You can customize the admin theme by creating a theme that inherits from TheAdmin, overriding specific shapes, or injecting custom resources.

Overriding the Admin Branding

Create a shape override for the admin header branding by defining a Header.cshtml shape in your module or custom admin theme:


    
        
            
        
    

Injecting Custom Admin Styles

Use a resource manifest to add custom CSS to the admin panel:

using OrchardCore.ResourceManagement;

public sealed class ResourceManifest : IResourceManifestProvider
{
    public void BuildManifests(IResourceManifestBuilder builder)
    {
        var manifest = builder.Add();

        manifest
            .DefineStyle("MyModule.AdminStyles")
            .SetUrl("~/MyModule/css/admin-custom.min.css", "~/MyModule/css/admin-custom.css");
    }
}

Then register a resource filter to include the styles on admin pages:

using OrchardCore.ResourceManagement;

[RequireFeatures("OrchardCore.Admin")]
public sealed class Startup : StartupBase
{
    public override void ConfigureServices(IServiceCollection services)
    {
        services.AddResourceConfiguration();
    }
}

public sealed class AdminResourceFilter : IResourceFilterProvider
{
    public void AddResourceFilter(ResourceFilterBuilder builder)
    {
        builder
            .WhenAdmin()
            .IncludeStyle("MyModule.AdminStyles");
    }
}

Admin Settings Pages

Admin settings pages allow module authors to expose configurable options in the admin panel. The recommended pattern uses ISiteService to persist settings as part of the site configuration document.

Defining a Settings Model

public sealed class NotificationSettin

…

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [CrestApps](https://github.com/CrestApps)
- **Source:** [CrestApps/CrestApps.AgentSkills](https://github.com/CrestApps/CrestApps.AgentSkills)
- **License:** MIT
- **Homepage:** https://crestapps.com/

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.