Hide modes in page editor (targeting, timewarp, design, developer and scaffolding) | Community
Skip to main content
Level 2
Nov 15, 2018 10:37 AM UTC
Solved

Hide modes in page editor (targeting, timewarp, design, developer and scaffolding)

Hello,

I have a request where we need to hide all options except for edit and preview from the mode selector in aem author:

Do you know how can we hide this modes (targeting, timewarp, design, developer and scaffolding) for a specific group?

Regards.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Nov 15, 2018 12:02 PM UTC

You can check the group via making Ajax request if user is not part of group and you can execute code to disable or hide options.

You just need to write extra JS code in above code to make ajax request and execute code

(function($, $document) {

    "use strict";

// code to make ajax request and get true or false

if(true){

    $(document).on("click", ".editor-GlobalBar-layerSwitcher", function(e) {

    var field = $("button.js-editor-LayerSwitcherTrigger[coral-list-item]");

    if (typeof field !== undefined) {

      field.each(function() {

      if($( this ).val() === "Scaffolding" || $( this ).val()==="Timewarp"){ // can be added targeting,  design, developer

      $( this ).attr("disabled", true);

      }

      });

    }

    });

}

})($, $(document));

Arun Patidar

1 reply

arunpatidar
arunpatidarAccepted solution
New Participant
Nov 15, 2018 12:02 PM UTC

You can check the group via making Ajax request if user is not part of group and you can execute code to disable or hide options.

You just need to write extra JS code in above code to make ajax request and execute code

(function($, $document) {

    "use strict";

// code to make ajax request and get true or false

if(true){

    $(document).on("click", ".editor-GlobalBar-layerSwitcher", function(e) {

    var field = $("button.js-editor-LayerSwitcherTrigger[coral-list-item]");

    if (typeof field !== undefined) {

      field.each(function() {

      if($( this ).val() === "Scaffolding" || $( this ).val()==="Timewarp"){ // can be added targeting,  design, developer

      $( this ).attr("disabled", true);

      }

      });

    }

    });

}

})($, $(document));

Translate
Arun Patidar