Monday, February 8, 2016

Sitecore Pipeline : Add controls to sitecore at runtime through renderContentEditor

If you are looking at customizing page editor and incorporate more settings the way content editor got we can make use of following approaches. The reference links are quite helpful to look more internals of core database and how to built experience editor.

Approach 1- restricted to URL


using System.Web;
using System.Web.UI;
using Sitecore.Pipelines;

namespace Demo.SC.Practical
{
    public class InjectScript
    {
        public void Process(PipelineArgs args)
        {
            var url = HttpContext.Current.Request.Url.AbsolutePath;

          if (url.Contains("field%20editor") || url.Contains("field editor"))
          {
                AddControl("some script tags");
          }
          AddControl("some script tags");
          AddControl("some script tags");         
        }

        private static void AddScript(string headerScript)
        {
            Sitecore.Context.Page.Page.Header.Controls.Add(new LiteralControl(headerScript));
        }
    }
}
Approach 2 - referred from blog reference below. Restricted to configuration.
 
Reference:

https://jammykam.wordpress.com/2014/04/24/adding-custom-javascript-and-stylesheets-in-the-content-editor/

Custom Control
https://jammykam.wordpress.com/2014/04/24/hiding-content-editor-fields-depending-on-selected-values/

Custom Text Field - Limit
http://www.partechit.nl/nl/blog/2013/03/text-fields-with-limited-length-and-feedback-during-editing

Editing Meta Data in Sitecore for SEO- page Editor Mode.

http://www.sitecore.net/learn/blogs/technical-blogs/getting-to-know-sitecore/posts/2012/10/page-editor-secrets-2-editing-meta-data.aspx

https://blog.istern.dk/2015/03/02/running-sitecore-field-editor-from-a-speak-command-in-sitecore-experience-editor/

Adam Conn- Custom Field Editor
http://www.sitecore.net/learn/blogs/technical-blogs/getting-to-know-sitecore/posts/2013/10/field-editor-for-rendering-properties.aspx


Page Editor Blogs

https://pageditor.wordpress.com/



 

No comments :