bnomei / kirby3-autoid

Automatic unique ID for Pages, Files and Structures including performant helpers to retrieve them. Bonus: Tiny-URL.
https://forum.getkirby.com/t/kirby3-autoid-plugin/23572
MIT License
80 stars 8 forks source link

Support drafts #61

Open bnomei opened 3 years ago

pichiste commented 2 years ago

Hi, wondering if there are still plans to support drafts. I'm using this plugin to create relationships between draft pages before publishing everything, but the lack of drafts support is causing display issues in the panel UI.

Thanks

bnomei commented 2 years ago

as far as i can tell from my last commits in feb 21 i switched to kirbys core lookup for drafts. i am not sure why i did not close this issue back then. seems done. 🤷‍♂️

what exactly does not work for you in the panel?

pichiste commented 2 years ago

Hi @bnomei, thanks for your response. Basically, in a section blueprint I want to display the title of a related page like this:

info: "{{ page.people.toStructure().first.foreignkey.fromAutoID().title }}"

...where foreignkey is a valid autoid.

This works fine when the page of that autoid is published, but not when it is a draft.

The reason seems to be that the autoid() helper (used by fromAutoID), doesn't work with drafts, at least according to the docs: "autoid()-helper will not find drafts, so make it unlisted/listed" https://github.com/bnomei/kirby3-autoid/wiki/PHP:-autoid(),-Field-Method-fromAutoID()#create-a-pagefile-programmatically-and-retrieve-autoid