processwire-requests icon indicating copy to clipboard operation
processwire-requests copied to clipboard

Get the page that the PageTable field belongs to

Open trk opened this issue 7 years ago • 1 comments

Short description of the enhancement

This request is :

Clone of this wrong place issue : https://github.com/processwire/processwire-issues/issues/506 Connected with this issue : https://github.com/adrianbj/CustomUploadNames/issues/7

I am using CustomUploadNames module with my projects. I have rules for renaming uploaded files. If page created by PageTable module (auto-name), renaming for uploaded files not working well, i want to rename files based on the page that the PageTable field belongs to.

@adrianbj Currently it's not really possible to get the page that the PageTable field belongs to.

I have an issue on CustomUploadNames module repo adrianbj/CustomUploadNames#7

@adrianbj comment :

Hi @ukyo - thanks for the access, but I am not really sure how I can help you at the moment. Currently it's not really possible to get the page that the PageTable field belongs to. I think you need to contact Ryan to see if he'll add $editID to the query string on this line: https://github.com/processwire/processwire/blob/8acd06646ff55af4dca6e4aa61991165b94c3447/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTable.module#L149 That is part of issue, but then it also needs to be propagated to the next step in creating the page (after you save the page with the title field populated). Once it's available there, CustomUploadNames will be able to use it to populate the image name as defined.

@ryancramerdesign can you add this feature to PageTable module ?

ProcessWire version: 3.093 (Optional) PHP version: 7.2 (Optional) MySQL version: Mariadb (Optional) Any 3rd party modules that are installed and could be related to the issue: CustomUploadNames

Optional: Steps that explain the enhancement

Getting root parent of PageTable page.

Current vs. suggested behavior

Its not possible to find real root parent or not possible to get real parents of nested PageTables. after It will be possible to use PageTable parents anywhere you want. (ProcessCustomUploadNames)

Why would the enhancement be useful to users?

Using this enhancement for renaming uploaded files by Page name. And need to get data from parents.

Optional: Screenshots/Links that demonstrate the enhancement

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

@trk

I tried to access real parents of page table but, parents comes in ProcessWire page structure.

ekran resmi 2018-03-05 14 59 27

@adrianbj

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

trk avatar Mar 05 '18 16:03 trk

Commenting here to add support for this request.

The PageTable page needs some property to identify its owner/parent page and this would simultaneously serve to identify that the page is a PageTable page, which is also useful to know. This is needed at least at runtime so it can be detected in saveReady hooks, but preferably as a persistent property maybe via $page->meta().

Toutouwai avatar Jul 19 '23 00:07 Toutouwai