Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Page/Filepicker should store file inserttag instead of real path in the database #8578

Closed
timgatzky opened this issue Nov 24, 2016 · 9 comments
Assignees
Labels
Milestone

Comments

@timgatzky
Copy link

timgatzky commented Nov 24, 2016

Hi guys,
take a regular Hyperlink element, choose a file... Contao will store the real path in e.g. tl_content.url. In case of moving/renaming the file/folder, the link to the file will get broken.
The filepicker should store the file:: inserttag here to keep the file in sync.
If the file is not in snyc yet, add it in the save_callback.

Current state:
screenshot_1708

Should be state:
screenshot_1707

@fritzmg
Copy link
Contributor

fritzmg commented Nov 24, 2016

This is a feature that has been requested in the past in various issues. However, the discussions always strayed away (or the original post of the issue wasn't really about that, but the following discussion evolved into a discussion about such a feature) and all of these issues got closed without further explanation or discussion. I have implemented this feature in fritzmg/contao-filepicker-uuid but this should definitely be something that should be present in the Core.

@Toflar
Copy link
Member

Toflar commented Nov 24, 2016

should definitely be something that should be present in the Core.

Why is there no pull request if I may ask?

@fritzmg
Copy link
Contributor

fritzmg commented Nov 24, 2016

I planned on making a PR for Contao 4, since it's a new feature. However, I haven't really got a clue yet how to do that there. I am guessing it should be implemented directly in DC_Table?

@timgatzky
Copy link
Author

timgatzky commented Nov 24, 2016

Well, I stumbled upon this today, well one of our clients did. Since I did not know if you guys already had that issue on the screen, I did not make any effort yet.
So, there is nothing planed yet? The filepicker itself and the javascript must be changed here. I can take a closer look. Should be similar for C4 here, right?

@fritzmg
Copy link
Contributor

fritzmg commented Nov 24, 2016

No changes to the filepicker or JavaScript are necessary. You just need to convert any file paths to a {{file::*}} insert tag when writing to the database and convert any {{file::*}} insert tags to file paths when reading from the database (for readability in the backend).

This is already done for the text field btw.

@timgatzky
Copy link
Author

timgatzky commented Nov 24, 2016

Yes, true. save_callback and load_callback should do the trick.
Are you on this or shall I do?

timgatzky added a commit to timgatzky/contao-core that referenced this issue Nov 24, 2016
@timgatzky
Copy link
Author

timgatzky commented Nov 24, 2016

Hi, take a look: timgatzky@5f539f3

Example for tl_content.url

@fritzmg
Copy link
Contributor

fritzmg commented Dec 7, 2016

I would put it directly into the DataContainer.php. This is where it's done for the text element too. See /system/modules/core/classes/DataContainer.php#L344-L348

@leofeyer leofeyer added this to the 4.4.0 milestone Dec 20, 2016
@leofeyer leofeyer self-assigned this May 15, 2017
@leofeyer
Copy link
Member

Changed in contao/core-bundle@3e20858.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants