Copied to clipboard

Flag this post as spam?

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


  • Kåre Mai 45 posts 283 karma points
    Aug 21, 2024 @ 08:06
    Kåre Mai
    0

    Unifying BlockListItem and BlockGridItem

    Hi,

    Is there any way to "unify" the view file rendering for BlockListItems and BlockGridItems?

    It seems weird that you have to create two completely identical view files for rendering a block through a BlockList or a BlockGrid?

    The only difference in the view file is the inherits line:

    @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListItem>
    

    vs.

    @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem>
    

    Is there any way that i can use the same rendering template so that the block can be used both in a Block List and a Block Grid?

  • Sebastian Dammark 583 posts 1407 karma points
    Sep 20, 2024 @ 06:41
    Sebastian Dammark
    0

    Did you ever find a solution for this ?

  • Kåre Mai 45 posts 283 karma points
    Sep 20, 2024 @ 08:16
    Kåre Mai
    0

    Unfortunately no. So right now i'm going with the bad solution of having two identical copies of the same code, which i have to remeber to update in both places if i make changes, with the only difference being the referenced BlockList or BlockGrid in the top of the file.

  • Sebastian Dammark 583 posts 1407 karma points
    Sep 23, 2024 @ 08:17
Please Sign in or register to post replies

Write your reply to:

Draft