jonasholfeld / kirby3-many-to-many-field

This plugin allows you to create many-to-many relationships between pages in Kirby and synchronizes them on both sides. Latest version also works with Kirby 4!
MIT License
50 stars 1 forks source link

Relations to draft pages appears broken #9

Closed pichiste closed 2 years ago

pichiste commented 2 years ago

When I attempt to create a relation to a draft page, I get this error:

Screenshot 2022-03-09 at 12 02 35

The problem seems to be the use of page() in index.php, which will only return published pages according to the docs:

"The page() helper fetches published pages only. To fetch a draft, you have to use $kirby->page('somepage')." Source: https://getkirby.com/docs/reference/templates/helpers/page

The solution seems to be to replace all instances of page() with kirby()->page().

Posting here instead of a PR just in case there's some side-effect I'm not thinking of.

Thanks!

pichiste commented 2 years ago

Closing this in favor of PR after all