So the first two lines work exactly how I would imagine, i.e. title and text come from the temporary.el.txt and temporary.en.txt depending from where I visit. The third line also works correctly, since it gets the contact details from commostuff.el.txt when I visit /el/temporary.
The fourth line returns always the page url without the appropriate /lang/ prefix.
Is it how it’s supposed to work?
And if yes, is there a common way to include the language prefix?
(I guess I could <?php echo $kirby->language()->url() ?> before each link)
What is the buttonURL field, a pages field? And what is your expected output? Because currently your code for that lines doesn’t really make sense. You convert to a page, but echoing a page object is pretty useless.
Yes, I must be missing something, so let me explain what I had in mind:
It’s a pages field, so for instance the user can choose from the panel which page a button should lead to. I want the link that will go into the href to be multi-lang (if it’s possible).
With toPage() you convert your field value into a page object. Once you have made sure this page object exists (that’s what we use the if statement for), you can use it in the same way you usually work with any other page, i.e. you can call all the available page methods ( https://getkirby.com/docs/reference/objects/pag) on this page object.