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


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

      type: array<Neos\Media\Domain\Model\Asset>
        label: 'Anlagen'
          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


*as usual: read the whole fusion-reference-part :frowning:
-> 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.


1 Like

I had no idea you needed to specify the property “resource” within this, makes sense now that I know now though!