Pro 6.3.x nesting parameters crashes page and returns server 500 error

Cascading / nesting parameters and using the parameter of a parent element as the value of a child parameter crashes Cornerstone and crashes the front-end with a Server 500 error.

I came across this error whilst setting up a Layout Component that contains within it a Component with design configuration settings on it. For example, the Layout Component is a section banner, which contains a simple heading and graphic device. The graphic device is itself another Component with design parameters set up to control color and size of the graphic device. For use in a page, I wish to allow the user to add the top level Layout Component, which has a stripped back set of parameters, just revealing the heading text, and the size and color of the graphic device.

The graphic device uses a parameter with the name of size, which is set as the font-size of the container within the component like so: {{dc:p:size}}.

The Layout Component then also has a parameter to control the size with the same name.

I then want to set the value of the size parameter on the graphic device to the parent value of size, by entering the same dc code: {{dc:p:size}}.


Saving and reloading this components page then returns this error in Cornerstone:

And if I try to place the parent Layout Component into a page, it returns a blank page.

This would also apply to advanced component sets of button variations within a public wrapping component, if you were to have a similar control structure for the child elements, with the parent component sending its parameters through.

If I recall correctly, this did work in a previous version of Pro, and the new parameters simply over-wrote any parent parameter values.

I’m not sure if I’m overlooking anything here. Are you referencing the same parameter you are trying to use? Like { "content": "{{dc:p:content}}" }? I think that would cause it to be empty. However I never had a crash from that. From what I could tell the Child parameters were overwriting the parent parameters if you used the same name. Do you have a template I could see?

Essentially yes, the _p_data for the component is something similar to the following:

{
  "background-color": "{{dc:p:background-color}}"
}

And this initially has nothing happen - the value is not pulled through to the component, but it is still possible to save as normal. However on refresh, it returns the PHP error and the cornerstone editor for that page does not show.

I have simplified this down a bit in my example now, with a button as a component with two parameters, background-color and text-color. I then pull this into a blank page in a section, and on the section I add the same two parameters. Trying to set the Background Color of the button component to the parameter value from the section causes this issue.

I have added a link to the exported template in a secure note.

The problem has arisen as I have been trying to develop a templating system for some websites where the sets of components are combined within layout components in various ways, and by having a set structure for parameters across the board I am able to slot things together with ease and have defaults that will run down the hierarchy, e.g. having a section with a background-color control which will then influence all the components within it (buttons, content blocks, cards, etc) which are each components in their own right to reduce the amount of granular access site editors / sub-editors will have.

I hope this makes sense. If the link to the template file doesn’t work, I can share access to the dev site I have set this example up on.

1 Like

So currently when referencing a parameter with the same name as itself like in your background-color example, it will create an infinite loop. I’ll set it up to look at parent parameters or just return nothing in these instances for 6.4. Other notes here as this looks to be the same issue. Have a great day!

1 Like