Working on custom theme. Strange behavior in theme settings
-
March 20, 2023 at 9:44 pm #9633[anonymous]
I find that usually I am the problem here, but I have double checked and triple checked and think I have this right. Anyway – I have a section in my theme I am developing that is specifically for the FrontPage Hero. It has a couple options to select how you want your Call To Action buttons configured.
The Primary CTA had three options, so I am using a radio button. The Secondary CTA is basically a copy of the primary but with different setting names. Here is the code in the config.json:
{ "name": "primaryCTA", "group": "Front Page Hero", "label": "Primary Call to Action", "value": "link", "type": "radio", "options": [ { "label": "None", "value": "none" }, { "label": "URL", "value": "link" }, { "label": "Post", "value": "post" } ] }, { "name": "primaryCTAText", "group": "Front Page Hero", "label": "Primary Button Text", "value": "Learn More", "type": "text", "dependencies": [{ "field": "primaryCTA", "value": "post" }] }, { "name": "primaryCTAPost", "group": "Front Page Hero", "label": "Link to Post", "value": "", "type": "posts-dropdown", "dependencies": [{ "field": "primaryCTA", "value": "post" }] }, { "name": "primaryCTAText", "group": "Front Page Hero", "label": "Primary Button Text", "value": "Learn More", "type": "text", "dependencies": [{ "field": "primaryCTA", "value": "link" }] }, { "name": "primaryCTALink", "group": "Front Page Hero", "label": "URL", "value": "", "type": "text", "dependencies": [{ "field": "primaryCTA", "value": "link" }] }, { "name": "secondaryCTA", "group": "Front Page Hero", "label": "Secondary Call to Action", "value": "link", "type": "radio", "options": [ { "label": "None", "value": "none" }, { "label": "URL", "value": "link" }, { "label": "Post", "value": "post" } ] }, { "name": "secondaryCTAText", "group": "Front Page Hero", "label": "secondary Button Text", "value": "Learn More", "type": "text", "dependencies": [{ "field": "secondaryCTA", "value": "post" }] }, { "name": "secondaryCTAPost", "group": "Front Page Hero", "label": "Link to Post", "value": "", "type": "posts-dropdown", "dependencies": [{ "field": "secondaryCTA", "value": "post" }] }, { "name": "secondaryCTAText", "group": "Front Page Hero", "label": "secondary Button Text", "value": "Learn More", "type": "text", "dependencies": [{ "field": "secondaryCTA", "value": "link" }] }, { "name": "secondaryCTALink", "group": "Front Page Hero", "label": "URL", "value": "", "type": "text", "dependencies": [{ "field": "secondaryCTA", "value": "link" }] },
When I close and re-open Publii to see that changes the Primary CTA has the correct radio button selected. However the Secondary CTA has no radio button selected. I have tried all three values – just in case. I have copied the working section (PrimaryCTA) and pasted it over the non-working section and renamed everything – in case it was a stupid typo I just could not see. Take a look at the image I am linking. Is this a known issue, have I found a new bug or what – I cannot figure it out.
Thanks
March 21, 2023 at 12:29 am #9638[anonymous]March 21, 2023 at 12:53 am #9643[anonymous]scratching my head… I think I will start from a more basic theme structure and build up instead of retorfitting.
Thanks for testing.
March 21, 2023 at 4:24 am #9649[anonymous]Good luck! I know it sounds silly, but maybe restarting your PC / reinstalling Publii / changing the theme temporarily and then switching back to your original theme will un-gunk the app. Sometimes, that’s all it takes, or sometimes, it’s a missing comma in the config or something else asinine…