I have built a route for data coming from an API to display it as a virtual page. So far so good with Page::factory
for adding slug
, template
, contents
, … .
But now I’ld like to know how I have to setup the translations
from it. As far as I see, it should be a Collection
. Is there any tips on how I have to set this up so my language-switch-navigation works?
Thx!
Bart
I can’t get this to work. Isn’t ContentTranslation
meant for dealing with the file where the translated content lives?
I am somehow unable to hook the translated content to the virtual page to make the language switch nav (via $page->url($language->code())
in a loop over the available languages - in the template) to work.
Edit:
Each item in $page->translation()
looks like this:
object(Kirby\Cms\ContentTranslation)[375]
public 'code' => string 'fr' (length=2)
public 'content' =>
array (size=0)
empty
public 'exists' => boolean false
public 'slug' => null