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

Fixing bug with creating relations to draft pages #10

Closed pichiste closed 9 months 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().