XF 2.2 Turn download button into a static link?

Sirmadsen

Active member
Is there a way to turn the Resource download button into a link that always points to the same link instead of the last file added?

What I want is to have the download button link to the history tab to show all available versions, no matter if the file is uploaded or url added.

Thanks
 
You'll need to edit the template xfrm_resource_wrapper_macros

Find (should be line 39 thru 42):
HTML:
                                    <xf:button href="{{ link('resources/download', $resource) }}" target="_blank"
                                        class="button--cta"
                                        data-xf-click="{{ $resource.CurrentVersion.file_count > 1 ? 'overlay' : '' }}"
                                        icon="download">{{ phrase('download') }}</xf:button>

Replace:
HTML:
                                    <xf:button href="{{ link('resources/history', $resource) }}"
                                        class="button--cta"
                                        data-xf-click="{{ $resource.CurrentVersion.file_count > 1 ? 'overlay' : '' }}"
                                        icon="download">{{ phrase('download') }}</xf:button>
 
You'll need to edit the template xfrm_resource_wrapper_macros

Find (should be line 39 thru 42):
HTML:
                                    <xf:button href="{{ link('resources/download', $resource) }}" target="_blank"
                                        class="button--cta"
                                        data-xf-click="{{ $resource.CurrentVersion.file_count > 1 ? 'overlay' : '' }}"
                                        icon="download">{{ phrase('download') }}</xf:button>

Replace:
HTML:
                                    <xf:button href="{{ link('resources/history', $resource) }}"
                                        class="button--cta"
                                        data-xf-click="{{ $resource.CurrentVersion.file_count > 1 ? 'overlay' : '' }}"
                                        icon="download">{{ phrase('download') }}</xf:button>
Thanks!

However I've solved it by hiding it instead and then adding a new button in the action bar. Looks better this way for what I'm trying to do.
downbutton.webp
 
Back
Top Bottom