Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John C Scott 473 posts 1183 karma points
    Nov 22, 2016 @ 12:37
    John C Scott
    0

    Many document types, one controller

    I'm mulling an idea where I would have a set of 5 very similar document types which shared almost all the same properties (mainly by virtue of using Composites) and a strongly typed model which could map to all the different very similar document types.

    There would in fact be only one property different between the documents but it would need to use a different data type, also these document types are valid in different places in the content tree.

    I want to have a custom controller for these but because the naming convention is based upon the name of the document type it seems I would have to have 5 identical controllers. Is there any way to avoid this? Can a controller in some way be applied to more than one document type?

  • Chris Roberts 74 posts 106 karma points c-trib
    Nov 22, 2016 @ 13:13
    Chris Roberts
    0

    Perhaps you could have a single base class and 5 appropriately-named classes (which are largely empty) that inherit from it?

    Other than that, I think you could implement a custom route - https://our.umbraco.org/documentation/Implementation/Custom-Routing/

Please Sign in or register to post replies

Write your reply to:

Draft