Advance background upper and lower background control with parameters

Hi

I am just creating an element that i need to create a simplified control panel for where a user can set the background colour of a section and then choose to add a semi transparent background image if they require that effect.
I have used the following parameter code to allow the user to control if there is a background image but i am getting stuck with controlling the advanced background upper and lower controls.

i have tried {{dc:param:bgImage-Yes-No}} to switch the type of the upper background as well as {{dc:p:bgImage-Yes-No}} but that doesn’t seem to work. Can you advise where i am going wrong. I assume this is something to do with the advanced background toggle and the correct value to pass to the upper or lower layer type field. Many thanks

{
“bgColor” : {
“label” : “Background”,
“type” : “color”,
“initial” : “#000000”
},
“bgImage” : {
“label” : “Background Image”,
“type” : “image”,
“initial” : “”,
“height” : 3
},
“bgImage-Yes-No” : {
“type” : “toggle”,
“label” : “Background Image On”,
“on” : “Background Image”,
“off” : “None”,
“initial” : “None”
}

}

Hello @The_Capture_Factory,

Thanks for writing to us.

I suggest updating the JSON for the parameter to make the toggle return a simple boolean.

{
  "bg_color": {
    "label": "Background Color",
    "type": "color",
    "initial": "#000000"
  },
  "use_bg_image": {
    "label": "Use Background Image",
    "type": "toggle",
    "on": true,
    "off": false,
    "initial": false
  },
  "bg_image": {
    "label": "Background Image",
    "type": "image",
    "initial": "",
    "height": 3,
    "when": "{{dc:p:use_bg_image}}"
  }
}

You can use this dynamic content tag {{dc:p:bg_image}}

Hope it helps
Thanks

Hi

I have added the JSON as you suggest and added the dynamic content as per the screenshot but how do i get the use background image toggle to work

is it as follows ?

Hey @The_Capture_Factory,

Thank you for following up.

Update your parameter into this one:

{
  "bg_color": {
    "label": "Background Color",
    "type": "color",
    "initial": "#000000"
  },
  "use_bg_image": {
    "label": "Use Background Image",
    "type": "toggle",
    "on": true,
    "off": false,
    "initial": false
  },
  "bg_image": {
    "label": "Background Image",
    "type": "image",
    "initial": "",
    "height": 3,
    "when": "eq(use_bg_image, true)"
  }
}

Best Regards.

this doesn’t seem to have made any difference. Am i implementing the parameters correctly in the second screen shot?

Hey @The_Capture_Factory,

We would be happy to double-check your element parameter if we can log in. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
– Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

image

Best Regards.

Details sent on secure note

Hey @The_Capture_Factory,

The correct JSON should be this:

{
 "bgColor" : {
    "label"   : "Background",
    "type"    : "color",
    "initial" : "#000000"
  },
  "use_bg_image": {
    "label": "Use Background Image",
    "type": "toggle",
    "on": "image",
    "off": "none",
    "initial": "none"
  },
  "bgImage" : {
    "label"   : "Background Image",
    "type"    : "image",
    "initial" : "",
    "height"  : 3,
    "when": "eq(use_bg_image, true)"
  }
}

The use_bg_image parameter should return “none” or “image” since you have used the {{dc:param:use_bg_image}} dynamic content in the Type field option of the Lower Background layer.

Hope this makes sense.