Skip to content

Dynamic Placeholders

Heiko Franz edited this page Nov 23, 2016 · 2 revisions

This feature in Atlas provides a "GUID based" implementation of dynamic placeholders. Dynamic placeholders allow adding the same placeholder to a page multiple times (e.g. a 50/50 split container).

Important: Ensure you use Experience Editor for configuring modules in a dynamic placeholder (since the dynamic name is only created in experience editor).

Enabling dynamic placeholders

To enable Atlas dynamic placeholders, enable 2 new pipeline processors e.g. through a Sitecore configuration patch file:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <getPlaceholderRenderings>
        <processor patch:before="*[@type='Sitecore.Pipelines.GetPlaceholderRenderings.GetAllowedRenderings, Sitecore.Kernel']"       
type="DeloitteDigital.Atlas.DynamicPlaceholders.Pipelines.GetPlaceholderRenderings.GetDynamicKeyAllowedRenderings, DeloitteDigital.Atlas" />
      </getPlaceholderRenderings>   
      <getChromeData>
        <processor patch:after="*[@type='Sitecore.Pipelines.GetChromeData.GetPlaceholderChromeData, Sitecore.Kernel']"
              type="DeloitteDigital.Atlas.DynamicPlaceholders.Pipelines.GetChromeData.GetDynamicPlaceholderChromeData, DeloitteDigital.Atlas" />
      </getChromeData>
    </pipelines>
  </sitecore>
</configuration>

Using dynamic placeholders

Once enabled, you can create dynamic placeholders in your views like this:

@using DeloitteDigital.Atlas.DynamicPlaceholders
<div>
        <div class="left">
           @Html.Sitecore().DynamicPlaceholder("column1")
        </div>
        <div class="right">
            @Html.Sitecore().DynamicPlaceholder("column2")
        </div>
</div>

These column1 and column2 placeholders can now appear multiple times within a page and different renderings can be added to them.

Clone this wiki locally