Hi all,
I am creating/working on a multi language site. At the moment two languages exist. More are planned so a dynamic listing of languages where needed would surely make sense.
Many images are part of the layout of a page. The images however are often language specific. To get the image with the correct language for a specific page/section all files for a specific section are first filtered. What I need, am trying to get to work, is a blueprint file in which all defined languages are listed as radio buttons to choose from.
At the moment my rather dirty solution/workaround is a API call in a blueprint file:
languages_radio:
label: Display for this language
type: radio
options: api
api:
url: "{{ site.url }}/../getDDLanguages.php"
fetch: data
text: "{{ item.name }}"
value: "{{ item.country }}"
The “/…/” portion of the path is needed because a language code is always part of the url. I haven’t found a way to get the url without.
The PHP file, positioned in the root of the website fetches the languages and creates JSON which gets “translated” and displayed in the panel. I believe this is not the best solution to accomplish such functionality. There must be an easier way to get this internal content displayed in the panel? I’m still rather new to Kirby, so I could very well be missing something very obvious. Maybe this can be solved with the query possibilities a blueprint file offers?