12

Is it possible to disable an option, Move Component, in the Experience Editor, for a specific rendering?

I have looked at the rendering and rendering options, but neither gave the possibility. I have also looked into user rights, but to no avail.

I have attached a picture of the button:

Move Component button

3
  • 2
    What do you want to achieve exactly? You don't want the rendering to be moved to another placeholder or you don't want the rendering to be moved at all? In case of the latter, what do you expect if another rendering is added and moved before or after the sticky rendering? Or what if the user removes and adds the sticky rendering? These actions may alter the order of your sticky rendering as well.
    – Thomas D
    Commented Sep 19, 2016 at 12:33
  • I do not want the rendering to be moved at all. I realized that this could be circumvented by enthustiastic authors. The so called sticky rendering is part of the page template. I value your valid concerns, and will take it into my considerations.
    – AndreasPK
    Commented Sep 20, 2016 at 7:35
  • you try: remove all items in "Allowed Controls" of placeholder settings. so all sublayout or rendering can add this placehoder. I do and it have worked.
    – Anh
    Commented Jun 21, 2017 at 9:47

3 Answers 3

6

Pipeline Method:

Option 1: Deep in the bowels of Experience Editor, you will find that eventually, the Move Component button is enabled/disabled based on the Allowed Renderings set on the placeholder. You could add a processor to the getPlaceholderRenderings to weed out the rendering you are looking for so that it acts like a static rendering. But keep in mind, that will cause Experience Editor to act like you can't put more of that control in the placeholder.

Option 2: Another Pipeline called getChromeData is what Experience Editor uses to control almost the entirety of the look and feel of itself. This controls the features for placeholders, fields, edit frames, and sublayouts/renderings. Mucking with a processor in this option might be the best from an upgrade-ability point of view

God-Mode Method:

For more control over the use of the options in Experience Editor, like the Move Component, another option is to create your own click method and either change the default rendering button, or create your own button.

You can achieve this by looking in the Core Database and finding this item: Move Component Button in Core DB

The particular chrome:rendering:sort command is actually handled in the RenderingChromeType.js file in the "Page Modes" application within the /sitecore/shell directory.

 handleMessage: function(message, params, sender) {
switch (message) {
  case "chrome:rendering:sort":
    this.sort();
    break;

You can augment this Javascript file to do what you want. However, beware that editing this javascript file could lead to upgrade stress in the future.

Another option that could be available to you is to create your own custom command, and patch it in. For example, if you set the click to be chrome:common:edititem({command:"webedit:validatesortablerendering"}) where webedit:validatesortablerendering is a custom command that you patch in, you can test the rendering type first (basically it would be the template type of the datasource item). If this is not a rendering that can be sorted, then abort further action. If it is, then call the Sitecore Javascript trigger to act on the event chrome:rendering:sort

In Summary:

There are a few ways to shave this yak. I think Pipeline Method Option 2 might be the best option, but it really depends on what your overall objective is and how destructive you want to be to Sitecore.

3

To disable editing of the specific rendering, you can Uncheck the Editable field on the rendering item.

When Editable is unchecked floating toolbar will not show up for that rendering.

Note that this option will keep allowing authors to edit the content in the rendering.

Sitecore Sample Rendering

2

One simple option could be: If you only allow that rendering for a specific placeholder when you click on move, you won't see any Move to here. Not as nice, but the same effect.

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.