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?
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.
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?
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
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.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
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.
is working on a reply...