Custom Partials

Last Updated: 2019-03-22

Besides adding custom stylesheets and scripts into the manager interface you can also add global partial views into the Layout of the manager. This is useful if you for example want to add a modal for a custom field that should be available on all manager views, or perhaps even a custom toolbar.

Adding the partial

The partial collection can be accessed from the Partials property. This collection holds all custom partials that has been added by your own code, or other modules. Below is an example of how to add a custom partial to the collection.

using Piranha;

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
...

App.Modules.Get<Piranha.Manager.Module>()
.Partials.Add("Partial/_MyModal");

...
}

All custom partials are rendered at the end of the body tag after the built-in modals have been added.