Good morning !
As said in title, I’m trying to conditionnally display fields in the theme settings, the same way we’d set up a conditionnal field on modules via the interface.
I’ve had a look at the code generated by setting up a condition on a module and tried to reproduce on the theme fields.json file, but the interface is giving me an error I can’t find my way around.
Basically I want to give users a way to choose whether they will be using a google font or a custom font from the theme settings (as currently, the themes don’t natively support picking a custom font from the theme settings, this is part of a workaround).
I’ve created a picker, which works fine, to let the user pick from custom fonts and google fonts.
I’ve got two font fields, primary and secondary, and I simply want to make them visible in the settings if the font_type selected is “google”.
The “visibility” code for both fields seems to have the right structure, but it won’t accept any value for the “controlling_field”.
I’ve tried to add the relative field path (font_type) or the full path (theme.global_fonts.font_type) but I can’t publish, it’s giving me an error :
Error:null: no controlling_field with id ‘theme.global_fonts.font_type’ exists
or
Error:null: no controlling_field with id ‘font_type’ exists
I’ve tried adding them with or without quotes also => not working…
Any help would be much appreciated !
Thanks,
Ludwig
