Closed teppokoivula closed 4 months ago
Thanks @teppokoivula those are good observations. I have pushed updates to the documentation for this to the dev branch, and it will appear in the live documentation once I update the ProcessWire version running the website.
Thanks, Ryan!
Docs page for Page currently states that Page::render() accepts only one argument, which is the field name:
Meanwhile the docs page for PageRender::renderPage() explains that you can also pass an array of custom variables in, and that this method actually accepts two arguments:
Additional confusion arises from the fact that according to Page docs Page::render() only accepts fieldname, while according to PageRender::renderPage() docs page it only accepts filename or options array.
I see that there's a "before" hook that changes the behaviour depending on whether the first argument looks like a field name, so PageRender::renderPage() docs page is not wrong, but it's still confusing when trying to figure out what Page::render() actually does/accepts (assuming that one has come this far in the first place) :)
... and finally, if a field name is passed as an argument to Page::render(), it actually accepts two arguments: field name and file name. Currently that behaviour doesn't seem to be documented.