Esempio n. 1
0
        public IHtmlString Render(LinkFieldWrapperOptions options)
        {
            var fieldRenderer = new FieldRenderer();

            if (options != null)
            {
                if (!string.IsNullOrWhiteSpace(options.InnerHtml))
                {
                    fieldRenderer.RenderParameters.Add(LinkFieldWrapperOptions.InnerHtmlParameterName, options.InnerHtml);
                }

                if (!string.IsNullOrWhiteSpace(options.Css))
                {
                    fieldRenderer.RenderParameters.Add(LinkFieldWrapperOptions.CssParameterName, options.Css);
                }

                fieldRenderer.RenderParameters.Add(LinkFieldWrapperOptions.OptionsParameterName, string.Empty);
                fieldRenderer.RenderParameters.Add(LinkFieldWrapperOptions.HrefDefaultParameterName, options.DisplayHrefByDefault.ToString());
                fieldRenderer.RenderParameters.Add(LinkFieldWrapperOptions.EditorCssParameterName, options.IncludeContentEditorCss.ToString());
            }

            fieldRenderer.Item      = Field.Item;
            fieldRenderer.FieldName = Field.Key;

            var result = fieldRenderer.RenderField();

            return(new HtmlString(result.FirstPart + result.LastPart));
        }
Esempio n. 2
0
        public string Render(LinkFieldWrapperOptions options)
        {
            var fieldRenderer = new FieldRenderer();

            if (options.HTML.Length > 0)
            {
                fieldRenderer.RenderParameters.Add("innerHTML", options.HTML);
            }

            if (options.CSS.Length > 0)
            {
                fieldRenderer.RenderParameters.Add("css", options.CSS);
            }

            fieldRenderer.Item      = Field.Item;
            fieldRenderer.FieldName = Field.Key;

            var result = fieldRenderer.RenderField();

            return(result.FirstPart + result.LastPart);
        }