December 3, 2014

Add a custom section in the content editor

Here the procedure to add a custom section after the Quick Info section in the content editor. Like this:

  • Create a new class like this:
    using Sitecore.Shell.Applications.ContentEditor.Pipelines.RenderContentEditor;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace SitecoreTestCustomizeContentEditor
    {
        public class TestSection
        {
            public void Process(RenderContentEditorArgs args)
            {
                args.EditorFormatter.RenderSectionBegin(args.Parent, "CustomInfo", "CustomInfo", "CustomInfo", "Applications/16x16/information.png", true, true);
                args.EditorFormatter.AddLiteralControl(args.Parent, "<div>test value</div>");
                args.EditorFormatter.RenderSectionEnd(args.Parent, true, true);
            }
        }
    }
  • Deploy this class in your bin folder
  • Add a pipeline into web.config in the renderContentEditor section like this
    <renderContentEditor>
     <processor type="SitecoreTestCustomizeContentEditor.TestSection, SitecoreTestCustomizeContentEditor" />
     <processor type="Sitecore.Shell.Applications.ContentEditor.Pipelines.RenderContentEditor.RenderSkinedContentEditor, Sitecore.Client" />
     <processor type="Sitecore.Shell.Applications.ContentEditor.Pipelines.RenderContentEditor.RenderStandardContentEditor, Sitecore.Client" />  
    </renderContentEditor>

5 comments:

  1. Hii !
    I am getting following error when i m trying to browse content error, also i m able to figure out that this error is because of adding following pipeline in web.config :


    The error is:
    Error Summary
    HTTP Error 500.0 - Internal Server Error
    The page cannot be displayed because an internal server error has occurred.
    Detailed Error Information
    Module ManagedPipelineHandler
    Notification ExecuteRequestHandler
    Handler PageHandlerFactory-Integrated-4.0
    Error Code 0x00000000
    Requested URL http://dev.samplesite.de.local:80/sitecore/shell/Applications/Content Editor?ic=People%2F16x16%2Fcubes_blue.png&he=Content%20Editor&cl=0
    Physical Path C:\inetpub\wwwroot\Sample\New\Dev\Website\sitecore\shell\Applications\Content Editor
    Logon Method Anonymous
    Logon User Anonymous

    Could you please suggest what is the mistake here? or is there any specific location where this class is supposed to be added. I added this class in NewSite.Kernel. Please suggest!

    ReplyDelete
  2. Could you please send the message from the log file to have all the details on it?
    And to reply to your second question: no you don't need to place it in a specific location as long as configure the correct namespace + dll in the .config file it should work.
    What is you version of Sitecore?

    ReplyDelete
    Replies
    1. Thanks! its working fine now.. i entered incorrect dll name.

      Delete
  3. Hi,

    I tried this and it is working but my "CustomInfo" shows up at the very end of all sections.How can I force it to showup just after "Quick Info" Section.

    Thanks,
    -Purnima.

    ReplyDelete
  4. Did you try to play with the sort order of your other sections?

    ReplyDelete