Copied to clipboard

Flag this post as spam?

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

  • Sprite 12 posts 122 karma points
    Feb 07, 2020 @ 14:25

    Controller for document type as element type

    Hello, i am trying to get a controller working on an document type that is listed as an element type. I have created an data type that can call this element type. So that on the content i can call this block dynamically if needed.

    Next i have created a partial view to work with this. and calling that in the template if needed so that it only shows when i select it.

    However now i need to add some custom code which i want to do with an controller that will only affect this element type. But i have no clue on how i can set this up (and if it even should be possible the way i want it.)

    I did manage to get controllers working with the base document types that are not element types. But even with those i can't seem to find a way to call the element type for some custom code.

    Does anyone know how i should approach this to make it working?

    i hope this is clear of what i am trying to do.

  • Nik 1300 posts 5503 karma points MVP 3x c-trib
    Feb 08, 2020 @ 11:09

    Hi Sprite,

    So, with full doc types you can route hijack them with the RenderMvcController, which is what I assume you meant you had done when you said I did manage to get controllers working with the base document type. However, as Element Types aren't routable in the same way you'd need to take a different approach.

    What I would do is create a surface controller and have an action that accepts the element type as parameter. That way you can pass in your element, perform your extra logic, and then return a partial view for rendering.


Please Sign in or register to post replies

Write your reply to: