I wanted to do the same thing as described in this issue: access the value of site field from the panel inside config.php.
So I applied the same suggested code as here:
But in a multilingual setup, the default language site info is then used in every languages. Seems doing this breaks something (in the order in which things are loaded maybe?) specifically in multilingual sites.
Is there a way to do this?
The use case is simply to have a config.php value store API key for some services and let client the possibility to update this value from the panel.
My website is french by default and has english as second language.
I translated the menu and other infos from site.fr.txt to site.en.txt (tokens are the same of course)
When the following config.php code is used with a multilingual site the data from site.en.txt is ignored. For example the menu defined in this blueprint is showed in french in both english and french versions of the website and panel… even though when I open the site.en.txt file with a text editor I can still see that it is in english.
That’s obviously caused by the 'ready' => function () { part but either it’s a bug or a faulty implementation on my part.
In any case here is what I want to do when I say “define APIs keys in the config.php file and use this info in the config.php file”:
(maybe that’s not possible with Kirby, I don’t know yet, so I tried)
# site.yml
title: Site
tabs:
pages:
icon: folder-structure
sections:
pages:
# pages section content
subpages:
# other pages section content
separator:
label: "|"
blog:
label: News
icon: megaphone
sections:
news:
# other pages type section content
products:
label: Produits
icon: glass
sections:
# yet another pages type section content
separator2:
label: "|"
Menu:
# menu content
label: Menu
icon: grid-top
fields:
primaryMenu: fields/menufields
secondaryMenu:
type: structure
fields:
secondaryMenuTitle:
type: text
label: Mainmenu item
secondaryMenuLink:
type: url
label: Lien
secondaryMenuTarget:
type: toggle
label: Nouvel onglet
socialIcons:
type: info
theme: passive
Footer:
icon: grid-bottom
bottom_footer:
label: Footer content
type: textarea
Settings:
icon: cog
type: fields
fields:
InstagramAccessToken:
type: text
hCaptchaSecret:
type: text
DeeplAPISecret:
type: text