v2.0 and Display Management changes #16807
Replies: 5 comments 18 replies
-
We removed |
Beta Was this translation helpful? Give feedback.
-
Because BuildDisplayAsync requires an updater. I just want my controllers to be able to return a shape from a POCO that contains a list of ContentType shapes so that I have one template that renders the list as a whole and one template that renders each list item. |
Beta Was this translation helpful? Give feedback.
-
@MikeAlhayek You did a lot of changes to display management in v2, maybe you can clarify this for him. |
Beta Was this translation helpful? Give feedback.
-
You don't need to register a DisplayManager. So remove the following line:
@kevinasdzine @ns8482e,
In addition, we've introduced new static methods in the
The same refactoring applies to the
And the following methods have been removed, with updated alternatives:
I also added PR #16814 to clarify the migration path. |
Beta Was this translation helpful? Give feedback.
-
I personally don't like these changes of removing I understand that orchard cms do not use Consider scenario where you really want to build a display shape that is based on form input - Now with this change user is forced to build editor shape and anyone using these framework methods are forced to editor shape or to build display mode for the editor shape instead of display shape. |
Beta Was this translation helpful? Give feedback.
-
I'm trying to convert an OC v1.8 solution to v2.0 and I'm not finding a good description on what new methods to use in regard to display management methods removed in v2.0.
Here's my example. I have a content type "CalendarEvent" - my drivers and templates for the individual event items work the same way on v2.0 but my controller, that gives me a list of events for the next month, does not.
Previously, an MVC controller that needed to return collections of content items worked like this:
services.AddScoped<IDisplayDriver<CalendarEventList>, CalendarEventListDisplayDriver>(); services.AddScoped<IDisplayManager<CalendarEventList>, DisplayManager<CalendarEventList>>();
public override IDisplayResult Display(CalendarEventList model, IUpdateModel updater)
which is where we would BuildDisplayAsync for each of the CalendarEvent items in the collectionHowever,
public override IDisplayResult Display(CalendarEventList model, IUpdateModel updater)
is no longer available andpublic override IDisplayResult Display(CalendarEventList model, BuildDisplayContext context)
does not function as a replacementInvalidOperationException: Unable to resolve service for type 'OrchardCore.DisplayManagement.DisplayManager`1[EventCalendar.Models.CalendarEventList]' while attempting to activate 'EventCalendar.Controllers.CalendarEventController'.
And all I have been able to find on github or the docs so far is that various display management methods have been removed but not what their replacements are.
I'm using this pattern for a number of controllers that return curated collections of content items.
Can anyone tell me what the recommended replacement for this controller pattern is under v2.0?
Beta Was this translation helpful? Give feedback.
All reactions