Change Header/Redirect Link for Certain Entity
Posted: 24 Mar 2024, 19:03
Hi all,
I have an entity in my app that stores documents, mainly PDF files (one per entry). I then link those document(s) in other entities/subentities. To reduce the number of clicks/pages a user has to make/see before downloading the document, I added a PHP field that generates a direct download link (using "&action=download_attachment&preview=1&file="). However, that field is "executed dynamically" and not stored in the database. Further, if I link the document entity to another, especially using a "List of records by MySQL query" field, the link to the document entity redirects to the info page and not the download link.
My question is: Is there a way to change a particular entity's header/redirect link using custom PHP (or editing the code) so that when a user clicks the link, the attached document in that entry downloads? That way, if a document entity is linked using the MySQL query, clicking the item in the query would download the document rather than redirect a user to the document's item info page.
Your help is much appreciated. This app has been an amazing discovery and help for my group's work.
For example or some more context—
Document Entity
Name: Example File
Attachment: Example.pdf
Created by: User
etc.
Meeting Entity
Meeting Name: ...
Meeting Date/Time: ...
File: *select Example PDF*
In the meetings listing, it would look like—
Meeting_Name | Meeting_Date_Time | Example.pdf (link to download rather than link to entity info page)
I have an entity in my app that stores documents, mainly PDF files (one per entry). I then link those document(s) in other entities/subentities. To reduce the number of clicks/pages a user has to make/see before downloading the document, I added a PHP field that generates a direct download link (using "&action=download_attachment&preview=1&file="). However, that field is "executed dynamically" and not stored in the database. Further, if I link the document entity to another, especially using a "List of records by MySQL query" field, the link to the document entity redirects to the info page and not the download link.
My question is: Is there a way to change a particular entity's header/redirect link using custom PHP (or editing the code) so that when a user clicks the link, the attached document in that entry downloads? That way, if a document entity is linked using the MySQL query, clicking the item in the query would download the document rather than redirect a user to the document's item info page.
Your help is much appreciated. This app has been an amazing discovery and help for my group's work.
For example or some more context—
Document Entity
Name: Example File
Attachment: Example.pdf
Created by: User
etc.
Meeting Entity
Meeting Name: ...
Meeting Date/Time: ...
File: *select Example PDF*
In the meetings listing, it would look like—
Meeting_Name | Meeting_Date_Time | Example.pdf (link to download rather than link to entity info page)