ProcessWire
ProcessWire copied to clipboard
PageTable page with page field and custom php code
I wanted to have a PageTable field store entry pages in a separate branch. The problem is:
Now when I create a new entry via a PageTable, I enter title and click save and it shows the page to edit (in the modal). So far so nice.
But the page isn't yet saved to the PageTable field and I can't use a page field using a custom php code to list pages that are relative to the page the PageTable is on. Only if closing and reopen the entry again it works, or if I choose to store the entry page under the page as children. But I don't want to do this cause they are in the way.
It's not a bug and I know why this is. My question is would it be possible to store the entry page to the PageTable field once it's created and being edited, so I can use custom php code in a page field?
Maybe adding the "page_id", where the PageTable item is created from, to the url GET? Otherwise I can't make a page select dynamic and relative to the page it is created on, and one has to first save/publish it, then reopen the item to get the page select to work.
Any ideas?
Just an idea, I did not try this myself. Did you try using "Automatic Page Name" for the pagetable?
Thanks, but this is a different issue not related to automatic page name or not. It's about PageTable field no yet saved, so the custom PHP code can't find search the field for the current editing page.
Any idea on this one?
Any news on this one? ...
I'd like to check in on this also - i'm running into a snag trying to assign the ID of the page that 'owns' the pagetable page because they are assigned to a separate branch of the tree. I will need that value available as soon as the first save is done, but before the modal closes, so that i can assign inherited values to the page, from the 'owner page'... I see that the data-url attribute contains the id of the owning page, so would wonder how hard it would be to add a property (forPage, or ownerPage) to the new page, to help with this...
Just hit this particular problem too :) would be super useful to have the solution @outflux3 proposes.
@elabx I'm not sure Ryan looks at issues on this repository now that the codebase has moved to the ProcessWire organisation. Please could you open a new issue on processwire-issues to ensure this doesn't get forgotten?