In this blog I am going to explain how to hide the Quick Info section in the content editor using code. We can show/hide Quick Info section manually by using below steps:
References:
Comments and suggestions are most welcome. Happy coding!
- Click on top-left burger menu and then click on Application Options from the menu. The Application Options dialog popup will appear.
- Check/uncheck Quick Info section checkbox in content editor tab and click on OK.
using Sitecore.Pipelines.LoggedIn;
using Sitecore.Shell;
namespace Sitecore.Ramblings
{
public class QuickInfo:Sitecore.Pipelines.LoggedIn.LoggedInProcessor
{
/// <summary>The process.</summary>
/// <param name="args">The args.</param>
public override void Process(LoggedInArgs args)
{
const string DefaultQuickInfo = "false";
Sitecore.Diagnostics.Assert.ArgumentNotNull(args, "args");
Sitecore.Diagnostics.Assert.IsTrue(
Sitecore.Security.Accounts.User.Exists(args.Username),
args.Username);
var user = Sitecore.Security.Accounts.User.FromName(
args.Username,
true);
Sitecore.Diagnostics.Assert.IsNotNull(user, "user");
var sitecoreDomain = Sitecore.SecurityModel.DomainManager.GetDomain(
"sitecore");
Sitecore.Diagnostics.Assert.IsNotNull(sitecoreDomain, "sitecoreDomain");
if (user.Domain != sitecoreDomain
|| user.Name.ToLower().EndsWith("\\" + sitecoreDomain.AnonymousUserName))
{
Sitecore.Diagnostics.Log.Warn(this + " : unexpected security domain or user : " + user.Name, this);
return;
}
var key = "/" + args.Username + "/UserOptions.ContentEditor.ShowQuickInfo";
if (!string.IsNullOrEmpty(user.Profile[key]))
{
user.Profile[key] = DefaultQuickInfo;
user.Profile.Save();
}
//bool showQuickInfo = UserOptions.ContentEditor.ShowQuickInfo;
}
}
}
Then patch below configuration change to add custom processor in loggedin pipeline and save the configuration file in App_Config\Include folder:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<processors>
<loggedin>
<processor patch:after="processor[position()=last()]" type="Sitecore.Ramblings.QuickInfo, Sitecore.Ramblings" />
</loggedin>
</processors>
</sitecore>
</configuration>
Now login in Sitecore content editor and Quick Info section will be hidden.
References:
Comments and suggestions are most welcome. Happy coding!


Very good, but I would improve your code by instead of using
ReplyDeletedeviceDefinition.GetRendering(rendering.RenderingID.ToString()).Datasource