2

How can we restrict the removal of a specific rendering from presentation details of any page item based on role? Everything else should function normally, such as editing the data source, etc.

My goal is to disable buttons such as 'remove,' 'move up,' and 'move down' in presentation details and restrict the removal or moving of a specific rendering from the Page item in both the content editor and experience editor."

enter image description here

Thank you.

2 Answers 2

2

On the file: sitecore\shell\Applications\Layouts\DeviceEditor\DeviceEditor.xml you have

  <Tab ID="ControlsTab" Header="Controls">
          <div class="scStretch">
            <Scrollbox ID="Renderings" Padding="0px" />
            <div class="optionButtons">
              <Button Header="Add" Click="device:add" style="margin-bottom: 6px"/>
              <Button Header="Edit" ID="btnEdit" Click="device:edit" style="margin-bottom: 6px"/>
              <Button ID="Personalize" Header="Personalize" Click="device:personalize" style="margin-bottom: 6px"/>
              <Button Header="Change" ID="btnChange" Click="device:change" style="margin-bottom: 6px"/>
              <Button Header="Remove" ID ="btnRemove" Click="device:remove" style="margin-bottom: 14px"/>
              <Button ID="Test" Header="Test" Click="device:test" style="margin-bottom: 14px"/>
              <Button Header="Move Up" ID ="MoveUp" Click="device:sortup" style="margin-bottom: 6px"/>
              <Button Header="Move Down" ID="MoveDown" Click="device:sortdown" style="margin-bottom: 6px"/>

            </div>
          </div>
        </Tab>

You need to decompile Sitecore.Shell.Applications.Layouts.DeviceEditor.DeviceEditorForm,Sitecore.Client and to hide the buttons based on current user and your needs.

1
  • 1
    Thanks, Vlad Iobagiu. I will try this solution.
    – Suresh R
    Mar 4 at 7:33
2

From below link you can get idea which files you can target to achieve your requirement, I have added New buttons in Device Editor.

https://github.com/rishishekhawat/AddMoveToTopAndBottomButtons

So updating same files with your logic can help you to disable buttons.

Hope this helps.

4
  • Thank you, Rishiraj Shekhawat. I tried your proposed solution as is for testing purposes. However, while clicking the rendering on the presentation details, it is giving the following error: Server Error in '/' Application. Calling AddMoveToTopAndBottomButtons.Models.CustomDeviceEditorForm.OnRenderingClick method through reflection is not allowed. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    – Suresh R
    Mar 4 at 7:51
  • Thanks, @Rishiraj Shekhawat. Finally, your solution worked for me after decompiling my latest "Sitecore.Client.dll" and follwoing your solution to override functionality.
    – Suresh R
    Mar 4 at 10:59
  • Any idea how to disable the 'move component' button and 'remove component' button in Experience Edge?
    – Suresh R
    Mar 4 at 11:12
  • @SureshR - If this answer is working, can you please accept this answer Mar 4 at 11:48

Your Answer

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

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