adrianbj / CustomUploadNames

ProcessWire module to automatically rename file (including image) uploads according to a configurable format
GNU General Public License v2.0
10 stars 2 forks source link

Request: can you add support for FieldtypePageTable #7

Open trk opened 6 years ago

trk commented 6 years ago

Can you add support for FieldtypePageTable ? Also depth (pagetable -> inside -> pagetable) support needed.

adrianbj commented 6 years ago

@trk - it seems to work fine in PageTable fields for me. I can't think of why it wouldn't because PageTables are real pages. Can you detail what's not working so I can try to reproduce.

trk commented 6 years ago

Yes its working, but filename comes from pagetable page title, not taking real page title.

An image inside page table page : ekran resmi 2018-02-13 17 52 29

But my real page title is : Destinations

I am using auto-naming for page tables. Also i have nested page tables, depth level 4. How can i deal with real page name for filenames ?

My current rule is:

ekran resmi 2018-02-13 17 56 57

adrianbj commented 6 years ago

Right - now I understand :)

The big problem is that there is no proper method for obtaining the parent page for a PageTable field: https://processwire.com/talk/topic/16210-how-to-capture-page-containing-a-pagetable/

I just spent a little time trying to implement Robin S's (@toutouwai) solution, but no luck so far. I'll try to get back to this when I have a little more time.

One other option for you might be RepeaterMatrix (if you have Profields). I even have a one-click converter in AdminActions to convert PageTable fields to RepeaterMatrix fields.

trk commented 6 years ago

No possible on my side, my components module working with FieldtypePageTable.

adrianbj commented 6 years ago

No possible on my side, my components module working with FieldtypePageTable.

Understood.

If you have time, and feel like trying to add PageTable support, I'd be very appreciative of a PR :)

trk commented 6 years ago

I will check it and will send you a demo link about my module preview.

Toutouwai commented 6 years ago

I just spent a little time trying to implement Robin S's (@Toutouwai) solution, but no luck so far.

That hook only allows you to get the parent page at the time the modal is saved/closed. It doesn't help if you need to get the parent page when the modal opens.

For that I think the only solution will be to add a GET variable containing the parent page ID to the links/buttons that open the modal. I haven't looked into it but doubt it could be achieved by a hook. Maybe JS? Or if no great hurry make a request for a change to the core?

adrianbj commented 6 years ago

@trk - I have added preliminary support to the dev branch. Please read the commit notes here: https://github.com/adrianbj/CustomUploadNames/commit/cda3e04d3e38ba737297090c8e75b5e216687b08

Let me know how it goes and what you think about my comments/questions about the options that aren't yet implemented.

trk commented 6 years ago

@adrianbj Thank you for your PageTable support. I tested dev branch, its working for first level.

How is it working now ? :

adrianbj commented 6 years ago

Sorry @trk - I am a little confused what the different levels are - do you have pagetable fields nested within other pagetable fields? Or something else?

I am also very restricted on my time at the moment, so it might be best if you could take a look at the issues and see if you can come up with a solution - you should get a decent idea of how things work by looking at that last commit.

Sorry I just don't have the time right now to dig into this too deeply.

trk commented 6 years ago

Yes, I have nested PageTables.

Ok, i will check it, i think need find Page here. I will check and let you know result.

trk commented 6 years ago

Its look like, its not possible to get real parents for PageTable.

I tried to access real parents of page table but, parents comes in ProcessWire page structure. For the moment i will use your dev branch, it is working for level 1.

ekran resmi 2018-03-05 14 59 27

adrianbj commented 6 years ago

Its look like, its not possible to get real parents for PageTable.

Do you it's maybe worth going bak to that PW issue (https://github.com/processwire/processwire-issues/issues/506) and explain to Ryan the issues you are still having?

trk commented 6 years ago

@adrianbj I opened a request, you can follow request from here : https://github.com/processwire/processwire-requests/issues/162