[Solved] How to make a Download-Link out of an Asset(-Array)

Hi.

I defined an asset-array in the inspector for a list of downloadable things:

   assets:
      type: array<Neos\Media\Domain\Model\Asset>
      ui:
        label: 'Anlagen'
        inspector:
          group: 'general'

and want to create links in afx with a neos.fusion:loop through the assets and a carbon.link:link for the assets.item. But always an object instead of a string raises an error. - understood, so far, i believe.

But. How do I get the Link from an asset? Where does that String (to convert) hide?
(Neos.Neos:ImageUri from the assets.item does only provide the icon - useful, but not what I want; Neos.Link.resolveAssetUri strikes because it wants a String - where is that string?)

Thanks alot for a hint.

best, H.

You can access the resource via asset.resource and use resourceuri

1 Like

*as usual: read the whole fusion-reference-part :frowning:
https://neos.readthedocs.io/en/stable/References/NeosFusionReference.html?highlight=resourceuri#neos-fusion-resourceuri
-> resource: (Resource) A Resource object instead of path and package

Ended up with

    assetList = Neos.Fusion:Loop {
        items = ${assets}
        itemRenderer = Neos.Fusion:Tag {
            tagName = 'li'
            content = Carbon.Link:Link {
                link = Neos.Fusion:ResourceUri {
                    resource = ${item.resource}  
                }
                content = ${item.title}
            }
        }
        @glue = " "
    }

and it worked.

Thanksalot.