/// <summary>
        /// Returns the Field Gutter Processor
        /// </summary>
        public static IFieldPlaceholderProcessor GetProcessor()
        {
            if (HttpContext.Current.Cache["FieldSuite.FieldPlaceholder.Processor"] != null)
            {
                return((IFieldPlaceholderProcessor)HttpContext.Current.Cache["FieldSuite.FieldPlaceholder.Processor"]);
            }

            XmlNode fieldGutterNode = Factory.GetConfigNode("fieldSuite/fields/fieldPlaceholder");

            if (fieldGutterNode == null || fieldGutterNode.ChildNodes.Count == 0)
            {
                return(null);
            }

            foreach (XmlNode node in fieldGutterNode.ChildNodes)
            {
                if (node.Name != "processor")
                {
                    continue;
                }

                string fullNameSpace = node.Attributes["type"].Value;

                //check to verify that xml was not malformed
                if (string.IsNullOrEmpty(fullNameSpace))
                {
                    continue;
                }

                //verify we can break up the type string into a namespace and assembly name
                string[] split = fullNameSpace.Split(',');
                if (split.Length == 0)
                {
                    continue;
                }

                string nameSpace    = split[0];
                string assemblyName = split[1];

                // load the assemly
                Assembly assembly = GetAssembly(assemblyName);

                // Walk through each type in the assembly looking for our class
                Type type = assembly.GetType(nameSpace);
                if (type == null || !type.IsClass)
                {
                    continue;
                }

                //cast to processor interface class
                IFieldPlaceholderProcessor processor = (IFieldPlaceholderProcessor)Activator.CreateInstance(type);
                if (processor == null)
                {
                    continue;
                }

                HttpContext.Current.Cache["FieldSuite.FieldPlaceholder.Processor"] = processor;
                return(processor);
            }

            return(null);
        }
        private string RenderMenuButtons(Sitecore.Shell.Applications.ContentManager.Editor.Field field, Item menu, bool readOnly)
        {
            Assert.ArgumentNotNull(field, "field");
            Assert.ArgumentNotNull(menu, "menu");
            HtmlTextWriter writer = new HtmlTextWriter(new StringWriter());

            writer.Write("<div class=\"scContentButtons\">");
            bool flag = true;

            foreach (Item item in menu.Children)
            {
                if (!this.IsFieldEditor || MainUtil.GetBool(item["Show In Field Editor"], false))
                {
                    if (!flag)
                    {
                        writer.Write("&#183;");
                    }
                    flag = false;

                    string clickEvent = string.Empty;
                    if (!string.IsNullOrEmpty(item["Message"]))
                    {
                        clickEvent = item["Message"];
                    }

                    FieldPlaceholderArgs fieldPlaceholderArgs = new FieldPlaceholderArgs();
                    fieldPlaceholderArgs.FieldId = field.ControlID;
                    if (this.CurrentItem != null)
                    {
                        fieldPlaceholderArgs.ItemId       = this.CurrentItem.ID.ToString();
                        fieldPlaceholderArgs.InnerItem    = CurrentItem;
                        fieldPlaceholderArgs.TemplateItem = CurrentItem.Template;
                    }
                    fieldPlaceholderArgs.Source     = GetFieldSource(field);
                    fieldPlaceholderArgs.ClickEvent = item["Message"];
                    fieldPlaceholderArgs.FieldItem  = menu;

                    IFieldPlaceholderProcessor fieldPlaceholderProcessor = FieldPlaceholderProcessorFactory.GetProcessor();
                    if (fieldPlaceholderProcessor != null)
                    {
                        clickEvent = fieldPlaceholderProcessor.Process(fieldPlaceholderArgs);
                        if (string.IsNullOrEmpty(clickEvent))
                        {
                            clickEvent = string.Empty;
                        }
                    }

                    //to send a message to the messaging system (handleMessage)
                    if (item["Client Event"] == null || string.IsNullOrEmpty(item["Client Event"]) || item["Client Event"] == "0")
                    {
                        clickEvent = Sitecore.Context.ClientPage.GetClientEvent(clickEvent);
                    }

                    if (readOnly)
                    {
                        writer.Write("<span class=\"scContentButtonDisabled\">");
                        writer.Write(item["Display Name"]);
                        writer.Write("</span>");
                    }
                    else
                    {
                        string cssClass = "scContentButton";
                        if (!string.IsNullOrEmpty(item["CssClass"]))
                        {
                            cssClass = item["CssClass"];
                        }

                        string innerHtml = item["Inner Html"];
                        if (string.IsNullOrEmpty(innerHtml))
                        {
                            innerHtml = item["Display Name"];
                        }

                        writer.Write("<a href=\"#\" class=\"" + cssClass + "\" onclick=\"" + clickEvent + "\">");
                        writer.Write(innerHtml);
                        writer.Write("</a>");
                    }
                }
            }
            writer.Write("</div>");
            return(writer.InnerWriter.ToString());
        }