1

Our solution is using dynamic placeholders. We have a requirement to restrict what renderings can be inserted in the page content (under the content placeholder) and in the sidebar (placeholder right-sidebar). The restriction should be applied on all nesting levels.

What I'd like to do is make a custom getPlaceholderRenderings processor which would return allowed renderings of the content placeholder for every placeholder rendered inside content. The challenge is in finding out the part of the page the placeholder is being rendered in.

2
  • Have you tried to access PlaceholderKey property (from GetPlaceholderRenderingsArgs)? I guess this returns placeholder path, so you can check whether you currently processed placeholder is nested under content/right-sidebar Jan 23, 2017 at 10:06
  • @AlanPłócieniak Thank you, this has worked well for me. Feel free to write up an answer and I'll mark it as accepted! Jan 24, 2017 at 16:48

1 Answer 1

1

GetPlaceholderRenderings pipeline will be executed for each placeholder on the page so you will be able to process each nested placeholder and a make decision about available renderings.

Your Process method accepts GetPlaceholderRenderingsArgs type as an argument.

GetPlaceholderRenderingsArgs type contains:

  • PlaceholderRenderings - list of Rendering items.
  • PlaceholderKey - current placeholder path

PlaceholderKey returns a placeholder path (not single placeholder key), so you can check whether your currently processed placeholder is nested under content/right-sidebar.

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.