5

I know that this might sound strange but, instead of adding rendering parameters to the different controls/modules on the page, I want to be able to add rendering parameters to the placeholder itself.

Is this possible?

I've tried to add a rendering parameter template to the placeholder template [/sitecore/templates/System/Layout/Placeholder] but, if this is the way to do it, I don't understand how to edit the rendering parameters on the page.

4
  • You're right this does sound strange. Perhaps if you explained what you are trying to achieve, we might be able to provide better suggestions.
    – Ben Golden
    Nov 2, 2016 at 2:30
  • Basically a client asked if instead of setting a few parameters on a per module basis, if he could do it at a placeholder level (ex: background color).
    – Snapper
    Nov 2, 2016 at 2:30
  • 1
    Wouldn't you just put the parameter on the rendering that contains the placeholder then?
    – Ben Golden
    Nov 2, 2016 at 2:32
  • Didn't think about that possibility to be honest. So, you reckon I should add a rendering that just contains the placeholder and some settings? This might actually do what I need. I'll give it a go. Thanks
    – Snapper
    Nov 2, 2016 at 2:34

2 Answers 2

6

You can't put rendering parameters on a placeholder, no. You can put rendering parameters on the rendering that contains the placeholder, though. And, if needed, you could create a "wrapper rendering" that just contained a placeholder and perhaps a wrapper div on which you could put classes, ids or other attributes to make it easier to style with CSS.

1
  • 1
    Ahh... haha.. I was taking the literal approach of thinking about adding rendering parameters on the placeholder, and completely forgetting about the placeholder rendering itself. The wrapper rendering is also a common practice when wanting to take care of CSS. Nice answer Ben.
    – Pete Navarra
    Nov 2, 2016 at 2:41
2

I don't think that this is immediately possible without heavy re-architecture of Sitecore's rendering pipelines. That being said, having time, a decompiler, and hacker-ninja skills, anything is possible.

The rendering of a placeholder is done differently and separately than the rendering of a rendering itself. Taking a quick look at the pipelines available in the Sitecore configuration, it becomes pretty obvious that architecturally changing placeholders in this manner would be pretty involved.

Additionally, as a rule of thumb, I generally advise people NOT to muck with System Templates too much (yes I know you can) due to unexpected results. Unless you are able to satisfactorily regression test Sitecore itself, and feel confident in your changes, I generally avoid that area.

But your question begs another question: Why?

Are you trying to default rendering parameters? In which case, you can utilize the Default Parameters field to set default values of the rendering.

Another thought I could see is if you have a multitude of components and you want to "lock" in the parameters, it might be possible to hook into the rendering pipeline, and substitute the default parameters for the rendering before it is added.

3
  • That's what I thought. Should be possible but heavily complicated for what I need. Basically a client asked if instead of setting a few parameters on a per module basis, if he could do it at a placeholder level (ex: background color). As this was something unexpected, I wanted to give it a go and take the opportunity to investigate what we can/can't do with the placeholder.
    – Snapper
    Nov 2, 2016 at 2:30
  • Yeah, I mean that's what I believe the intention behind Default Parameters was really intended for. Is that not enough for the client?
    – Pete Navarra
    Nov 2, 2016 at 2:31
  • Not familiar with Default Parameters. Will have a look.
    – Snapper
    Nov 2, 2016 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.