Copied to clipboard

Flag this post as spam?

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


  • Jeroen Oostwouder 104 posts 300 karma points
    Mar 01, 2023 @ 09:55
    Jeroen Oostwouder
    0

    Get linked content in Block-item template in CMS

    Hi there,

    I'm using the new BlockGridEditor in U10, and I would like to create a custom view for some blocks. Blocks with regular fields are working fine by using {{block.data.personName}}.

    With images, I used the example code {{mediaItem = block.data.photo.mediaKey | mediaItemResolver); ""}}. Works like a charm.

    But how do I get some fields from a linked node? Let's say I have a block which will show the title and intro of a linked news-item. How do I get this news-item-node in Angular? Is it even possible?

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Mar 01, 2023 @ 10:10
    Dave Woestenborghs
    0

    Hi Jeroen,

    You could use the ncNodeName filter. That works in custom labels for nested content and the block list editor.

    Maybe it will work in the block grid editor as well. I have not tried it.

    See https://docs.umbraco.com/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/block-editor/label-property-configuration

    Dave

  • Jeroen Oostwouder 104 posts 300 karma points
    Mar 02, 2023 @ 13:44
    Jeroen Oostwouder
    0

    Hi Dave,

    ncNodeName only returns the name, right? If possible, I want to show the user an example of the linked content within the blockgrid. Maybe by showing an image from the linked page.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Mar 02, 2023 @ 14:29
    Dave Woestenborghs
    100

    Hi Jeroen,

    ncNodename indeed only shows the name of the item. But maybe you can have a look at this code of this filter : https://github.com/umbraco/Umbraco-CMS/blob/contrib/src/Umbraco.Web.UI.Client/src/common/filters/nestedcontent.filter.js

    And then one of the mediaItemResolver : https://github.com/umbraco/Umbraco-CMS/blob/contrib/src/Umbraco.Web.UI.Client/src/common/filters/mediaItemResolver.filter.js

    This will probably give you enough pointers to get something built that fits your needs.

    Dave

  • Jeroen Oostwouder 104 posts 300 karma points
    Mar 06, 2023 @ 13:56
    Jeroen Oostwouder
    0

    I will give that a try.

    I was hoping there was allready some kind of contentItemResolver or something ;) But I'll look in to those links to create something myself.

    Thank you.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies