Find() page in specific language

I have a page that I only use to store info for a plugin (simple stats tool) in. Currently there are as many data files in that page as I have languages set up. While this might make for an interesting feature in my case, I would still like to have the combined data.

Is there a way to get a specific version of a page? Im thinking something like

$site->pages()->find('mypage', 'en') // This would be intuitiv I think but is taken by the collection API
$site->pages('en')->find('mypage') // So maybe like that?

If not, can I get the content in all languages somehow? Then I could merge the data myself…

How about using $page->language() with a conditional statement?

I can’t seem to find any documentation on it - what does that return?
In my case echo printed nothing and did not complain about not being able to convert anything to string…

You can use

$site->pages()->find('mypage')->content('en');

even shorter:

page('mypage')->content('en');
4 Likes

`$page->language()’ returns the language code for the current page, e.g. “de”. But of course this nice hidden feature @bastianallgeier just revealed is more useful:)

Awesome! Did I mention I love the new forum and the support here? :smile: