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.

  • 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 – Alan Płócieniak Jan 23 '17 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! – Dmytro Shevchenko Jan 24 '17 at 16:48
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, privacy policy and cookie policy

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