0

Is there any way to grey out the content editor archive button for all Sitecore items for every user It should look like this

Should  look like this

4
  • Are you asking about disabling the permissions so that users cannot use that button? Commented Nov 6, 2023 at 12:19
  • yes, but as per requirement, the button should be visible as shown in attached screenshot Commented Nov 6, 2023 at 12:27
  • 1
    You could deny the permission for a basic role for these items in the core database. Commented Nov 6, 2023 at 15:48
  • I think you want these buttons to be disabled but yet to be visible to content authors. Is that correct?
    – Ghan
    Commented Nov 7, 2023 at 17:13

2 Answers 2

1

This is the solution that worked for me

  1. Create a Custom Command: Create a new class that inherits from Sitecore.Shell.Framework.Commands.Command and implement the necessary logic for your button.
using Sitecore.Shell.Framework.Commands;
    public class MyCustomCommand : Command
    {
    public override void Execute(CommandContext context)
    {
        // Your custom logic here
    }

    public override CommandState QueryState(CommandContext context)
    {
        return CommandState.Disabled;
    }
}
  1. Configure the Command in Sitecore: Create an XML configuration file in your Sitecore solution, e.g., MyCustomCommand.config, to define your command. Place this file in the App_Config\Include folder.
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <commands>
      <command name="mycustomcommand" type="YourNamespace.MyCustomCommand, YourAssembly" />
    </commands>
  </sitecore>
</configuration>
  1. Add command to your button
1

To visually "grey out" a ribbon item, you can use custom CSS. You can apply CSS styles to make it appear disabled.

I checked the html element for the ribbon chunk you mentioned in Sitecore 9.3 and SC 10.3.1 and it seems that you can hide it using the CSS

.chunk#CE42470D6C6FC4F618BF7D87CC7A95659 {
      opacity: 0.5;
      pointer-events: none;
}

You can add this CSS in {webroot}/sitecore/shell/themes/standard/default/Ribbon.css or can create a custom CSS file for the same

Hope this helps!

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.