The following is for anyone who may be struggling with the same problem in .NET framework.
For our nested accordion requirement, we now have an editable area which handles the outer accordion, and a widget inserted within that which handles the inner accordion.
That widget has a page selector property which refers to a separate page type (with a controller) which has its own editable area for building the inner accordion.
To enable the PartialWidgetPage.Kentico.MVC package, we only had to register this single service:
builder.RegisterType<PartialWidgetPageHelper>().As<IPartialWidgetPageHelper>();
The widget view is as follows. It's just a case of using the html helpers to change the context to the aforementioned separate page type and then back again:
@model ComponentViewModel<InnerAccordionWidgetProperties>
@{
var selectedNodeGuid = Model.Properties.InnerAccordionPage?.FirstOrDefault()?.NodeGuid;
if (selectedNodeGuid != null)
{
var Context = Html.GetCurrentContext();
int docId = Html.GetDocumentIDByNode(selectedNodeGuid.Value);
Html.ChangeContext(docId);
Html.RenderAction("Index", "InnerAccordionPage");
Html.RestoreContext(Context);
}
else
{
<p>Select an inner accordion page in the widget settings...</p>
}
}