コード例 #1
0
        public string GetFormattedBodyContent(GetPropertyData getPropertyData, Controller controller)
        {
            ContentInfo content = GetContent(getPropertyData);

            object entity = content.Entity;

            if (entity is Webpage)
            {
                CurrentRequestData.CurrentPage = entity as Webpage;
            }
            HtmlHelper htmlHelper = MaterialCMSHtmlHelper.GetHtmlHelper(controller);

            return(htmlHelper.ParseShortcodes(content.Content).ToHtmlString());
        }
コード例 #2
0
        private MvcHtmlString ReturnTag(ImageInfo imageInfo, string alt, string title, object attributes)
        {
            var tagBuilder = new TagBuilder("img");

            tagBuilder.Attributes.Add("src", imageInfo.ImageUrl);
            tagBuilder.Attributes.Add("alt", alt ?? imageInfo.Title);
            tagBuilder.Attributes.Add("title", title ?? imageInfo.Description);
            if (attributes != null)
            {
                var routeValueDictionary = MaterialCMSHtmlHelper.AnonymousObjectToHtmlAttributes(attributes);
                foreach (var kvp in routeValueDictionary)
                {
                    tagBuilder.Attributes.Add(kvp.Key, kvp.Value.ToString());
                }
            }
            return(MvcHtmlString.Create(tagBuilder.ToString(TagRenderMode.SelfClosing)));
        }