Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Working on custom theme. Strange behavior in theme settings

  • #9633
    Avatar photo[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

    #9638
    Avatar photo[anonymous]

    That’s very bizarre… I copied your code and pasted it into the config.json > customConfig on my end, and URL was selected as the default…

    I tested this with Technews.

    Capture-123

    #9643
    Avatar photo[anonymous]

    scratching my head…  I think I will start from a more basic theme structure and build up instead of retorfitting.

    Thanks for testing.

    #9649
    Avatar photo[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…