Title (h2)

Subtitle (h3)

Your text comes here.

Adjust spacing (left, right, top & bottom) in content settings to your likings.

Benefits (H2)

Error executing template "Designs/Swift/Paragraph/Swift_Feature.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7707c8a0ef864297931f9e5582f29acd.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.IO 3 4 @functions 5 { 6 private string RenderCustomCSS(IEnumerable<string> decorations) 7 { 8 var cssClasses = new List<string>(); 9 10 foreach (var itemId in decorations) 11 { 12 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 13 item.TryGetValue("Class", out object classes); 14 15 if (classes is null) 16 { 17 continue; 18 } 19 20 var cssString = (string)classes; 21 22 if (cssString.StartsWith("[")) 23 { 24 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 25 cssClasses.AddRange(cssArray); 26 } 27 else 28 { 29 cssClasses.Add(cssString.Replace(",", " ")); 30 } 31 } 32 33 return string.Join(" ", cssClasses).Trim(); 34 } 35 } 36 37 @{ 38 string layout = Model.Item.GetRawValueString("Layout", "icon-top"); 39 string contentPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 40 contentPadding = contentPadding == "none" ? "" : contentPadding; 41 contentPadding = contentPadding == "small" ? "p-3 p-md-3" : contentPadding; 42 contentPadding = contentPadding == "large" ? "p-5 p-md-5" : contentPadding; 43 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 44 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 45 string css = RenderCustomCSS(decorations); 46 47 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && Model.Item.GetString("Link").Contains("http") ? "target=\"_blank\"" : string.Empty; 48 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && Model.Item.GetString("Link").Contains("http") ? "rel=\"noopener\"" : string.Empty; 49 string alignment = (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) && !string.IsNullOrEmpty(Model.Item.GetString("Text")) ? "align-items-stretch" : "align-items-center"; 50 51 string iconColor = Model.Item.GetString("iconColor", "text-inherit"); 52 string iconOpacity = Model.Item.GetString("IconOpacity", "opacity-100"); 53 54 string iconSize = Model.Item.GetRawValueString("IconSize", "2"); 55 string imageSrc = !string.IsNullOrEmpty(Model.Item.GetString("Image")) ? Model.Item.GetFile("Image").Path : string.Empty; 56 string flexGrowClass = string.Empty; 57 58 switch (layout) 59 { 60 case "icon-left": 61 case "icon-right": 62 flexGrowClass = "flex-grow-0"; 63 break; 64 } 65 66 string imagePath = imageSrc != string.Empty ? imageSrc : Model.Item.GetRawValueString("Icon", string.Empty); 67 imagePath = Path.GetExtension(imagePath).ToLower() != ".svg" ? "/Admin/Public/GetImage.ashx?image=" + imagePath + "&height=" + iconSize + "&width=" + iconSize + "&Crop=0&format=webp" : imagePath; 68 string imgAltText = Model.Item.GetRawValueString("FeatureAltText", string.Empty); 69 70 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h4"); 71 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 72 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 73 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 74 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity} m-0\">"; 75 string headingLevelStop = $"</{headingLevel}>"; 76 77 string textColor = Model.Item.GetString("TextColor", "text-inherit"); 78 string textOpacity = Model.Item.GetString("TextOpacity", "opacity-100"); 79 } 80 81 <div class="h-100 @(contentPadding)@(theme) @(css) item_@Model.Item.SystemName.ToLower()"> 82 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 83 @if (!string.IsNullOrEmpty(Model.Item.GetString("Link"))) 84 { 85 @:<a href="@Model.Item.GetString("Link")" class="text-decoration-none d-block h-100" @target @rel> 86 } 87 88 @switch (layout) 89 { 90 case "icon-top": 91 <div class="d-flex flex-column gap-3 text-center mb-0-last-child"> 92 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 93 {<div class="@flexGrowClass"> 94 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 95 { 96 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 97 } 98 else 99 { 100 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 101 } 102 </div> 103 } 104 105 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 106 { 107 <div class="mb-0-last-child"> 108 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 109 { 110 @headingLevelStart 111 @Model.Item.GetString("Title") 112 @headingLevelStop 113 } 114 115 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 116 { 117 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 118 } 119 </div> 120 } 121 </div> 122 break; 123 case "icon-left": 124 <div class="d-flex flex-row gap-3 h-100 text-start @alignment"> 125 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 126 {<div class="@flexGrowClass"> 127 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 128 { 129 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 130 } 131 else 132 { 133 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 134 } 135 </div> 136 } 137 138 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 139 { 140 <div class="d-flex flex-column flex-grow-1"> 141 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 142 { 143 @headingLevelStart 144 @Model.Item.GetString("Title") 145 @headingLevelStop 146 } 147 148 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 149 { 150 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 151 } 152 </div> 153 } 154 155 </div> 156 break; 157 case "icon-right": 158 <div class="d-flex flex-row gap-3 h-100 text-end @alignment"> 159 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 160 { 161 <div class="d-flex flex-column flex-grow-1"> 162 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 163 { 164 @headingLevelStart 165 @Model.Item.GetString("Title") 166 @headingLevelStop 167 } 168 169 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 170 { 171 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 172 } 173 </div> 174 } 175 176 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 177 {<div class="@flexGrowClass"> 178 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 179 { 180 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 181 } 182 else 183 { 184 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 185 } 186 </div> 187 } 188 </div> 189 break; 190 } 191 192 @if (!string.IsNullOrEmpty(Model.Item.GetString("Link"))) 193 { 194 @:</a> 195 } 196 </div> 197
Error executing template "Designs/Swift/Paragraph/Swift_Feature.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7707c8a0ef864297931f9e5582f29acd.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.IO 3 4 @functions 5 { 6 private string RenderCustomCSS(IEnumerable<string> decorations) 7 { 8 var cssClasses = new List<string>(); 9 10 foreach (var itemId in decorations) 11 { 12 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 13 item.TryGetValue("Class", out object classes); 14 15 if (classes is null) 16 { 17 continue; 18 } 19 20 var cssString = (string)classes; 21 22 if (cssString.StartsWith("[")) 23 { 24 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 25 cssClasses.AddRange(cssArray); 26 } 27 else 28 { 29 cssClasses.Add(cssString.Replace(",", " ")); 30 } 31 } 32 33 return string.Join(" ", cssClasses).Trim(); 34 } 35 } 36 37 @{ 38 string layout = Model.Item.GetRawValueString("Layout", "icon-top"); 39 string contentPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 40 contentPadding = contentPadding == "none" ? "" : contentPadding; 41 contentPadding = contentPadding == "small" ? "p-3 p-md-3" : contentPadding; 42 contentPadding = contentPadding == "large" ? "p-5 p-md-5" : contentPadding; 43 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 44 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 45 string css = RenderCustomCSS(decorations); 46 47 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && Model.Item.GetString("Link").Contains("http") ? "target=\"_blank\"" : string.Empty; 48 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && Model.Item.GetString("Link").Contains("http") ? "rel=\"noopener\"" : string.Empty; 49 string alignment = (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) && !string.IsNullOrEmpty(Model.Item.GetString("Text")) ? "align-items-stretch" : "align-items-center"; 50 51 string iconColor = Model.Item.GetString("iconColor", "text-inherit"); 52 string iconOpacity = Model.Item.GetString("IconOpacity", "opacity-100"); 53 54 string iconSize = Model.Item.GetRawValueString("IconSize", "2"); 55 string imageSrc = !string.IsNullOrEmpty(Model.Item.GetString("Image")) ? Model.Item.GetFile("Image").Path : string.Empty; 56 string flexGrowClass = string.Empty; 57 58 switch (layout) 59 { 60 case "icon-left": 61 case "icon-right": 62 flexGrowClass = "flex-grow-0"; 63 break; 64 } 65 66 string imagePath = imageSrc != string.Empty ? imageSrc : Model.Item.GetRawValueString("Icon", string.Empty); 67 imagePath = Path.GetExtension(imagePath).ToLower() != ".svg" ? "/Admin/Public/GetImage.ashx?image=" + imagePath + "&height=" + iconSize + "&width=" + iconSize + "&Crop=0&format=webp" : imagePath; 68 string imgAltText = Model.Item.GetRawValueString("FeatureAltText", string.Empty); 69 70 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h4"); 71 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 72 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 73 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 74 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity} m-0\">"; 75 string headingLevelStop = $"</{headingLevel}>"; 76 77 string textColor = Model.Item.GetString("TextColor", "text-inherit"); 78 string textOpacity = Model.Item.GetString("TextOpacity", "opacity-100"); 79 } 80 81 <div class="h-100 @(contentPadding)@(theme) @(css) item_@Model.Item.SystemName.ToLower()"> 82 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 83 @if (!string.IsNullOrEmpty(Model.Item.GetString("Link"))) 84 { 85 @:<a href="@Model.Item.GetString("Link")" class="text-decoration-none d-block h-100" @target @rel> 86 } 87 88 @switch (layout) 89 { 90 case "icon-top": 91 <div class="d-flex flex-column gap-3 text-center mb-0-last-child"> 92 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 93 {<div class="@flexGrowClass"> 94 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 95 { 96 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 97 } 98 else 99 { 100 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 101 } 102 </div> 103 } 104 105 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 106 { 107 <div class="mb-0-last-child"> 108 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 109 { 110 @headingLevelStart 111 @Model.Item.GetString("Title") 112 @headingLevelStop 113 } 114 115 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 116 { 117 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 118 } 119 </div> 120 } 121 </div> 122 break; 123 case "icon-left": 124 <div class="d-flex flex-row gap-3 h-100 text-start @alignment"> 125 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 126 {<div class="@flexGrowClass"> 127 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 128 { 129 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 130 } 131 else 132 { 133 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 134 } 135 </div> 136 } 137 138 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 139 { 140 <div class="d-flex flex-column flex-grow-1"> 141 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 142 { 143 @headingLevelStart 144 @Model.Item.GetString("Title") 145 @headingLevelStop 146 } 147 148 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 149 { 150 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 151 } 152 </div> 153 } 154 155 </div> 156 break; 157 case "icon-right": 158 <div class="d-flex flex-row gap-3 h-100 text-end @alignment"> 159 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 160 { 161 <div class="d-flex flex-column flex-grow-1"> 162 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 163 { 164 @headingLevelStart 165 @Model.Item.GetString("Title") 166 @headingLevelStop 167 } 168 169 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 170 { 171 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 172 } 173 </div> 174 } 175 176 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 177 {<div class="@flexGrowClass"> 178 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 179 { 180 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 181 } 182 else 183 { 184 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 185 } 186 </div> 187 } 188 </div> 189 break; 190 } 191 192 @if (!string.IsNullOrEmpty(Model.Item.GetString("Link"))) 193 { 194 @:</a> 195 } 196 </div> 197
Error executing template "Designs/Swift/Paragraph/Swift_Feature.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7707c8a0ef864297931f9e5582f29acd.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.IO 3 4 @functions 5 { 6 private string RenderCustomCSS(IEnumerable<string> decorations) 7 { 8 var cssClasses = new List<string>(); 9 10 foreach (var itemId in decorations) 11 { 12 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 13 item.TryGetValue("Class", out object classes); 14 15 if (classes is null) 16 { 17 continue; 18 } 19 20 var cssString = (string)classes; 21 22 if (cssString.StartsWith("[")) 23 { 24 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 25 cssClasses.AddRange(cssArray); 26 } 27 else 28 { 29 cssClasses.Add(cssString.Replace(",", " ")); 30 } 31 } 32 33 return string.Join(" ", cssClasses).Trim(); 34 } 35 } 36 37 @{ 38 string layout = Model.Item.GetRawValueString("Layout", "icon-top"); 39 string contentPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 40 contentPadding = contentPadding == "none" ? "" : contentPadding; 41 contentPadding = contentPadding == "small" ? "p-3 p-md-3" : contentPadding; 42 contentPadding = contentPadding == "large" ? "p-5 p-md-5" : contentPadding; 43 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 44 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 45 string css = RenderCustomCSS(decorations); 46 47 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && Model.Item.GetString("Link").Contains("http") ? "target=\"_blank\"" : string.Empty; 48 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && Model.Item.GetString("Link").Contains("http") ? "rel=\"noopener\"" : string.Empty; 49 string alignment = (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) && !string.IsNullOrEmpty(Model.Item.GetString("Text")) ? "align-items-stretch" : "align-items-center"; 50 51 string iconColor = Model.Item.GetString("iconColor", "text-inherit"); 52 string iconOpacity = Model.Item.GetString("IconOpacity", "opacity-100"); 53 54 string iconSize = Model.Item.GetRawValueString("IconSize", "2"); 55 string imageSrc = !string.IsNullOrEmpty(Model.Item.GetString("Image")) ? Model.Item.GetFile("Image").Path : string.Empty; 56 string flexGrowClass = string.Empty; 57 58 switch (layout) 59 { 60 case "icon-left": 61 case "icon-right": 62 flexGrowClass = "flex-grow-0"; 63 break; 64 } 65 66 string imagePath = imageSrc != string.Empty ? imageSrc : Model.Item.GetRawValueString("Icon", string.Empty); 67 imagePath = Path.GetExtension(imagePath).ToLower() != ".svg" ? "/Admin/Public/GetImage.ashx?image=" + imagePath + "&height=" + iconSize + "&width=" + iconSize + "&Crop=0&format=webp" : imagePath; 68 string imgAltText = Model.Item.GetRawValueString("FeatureAltText", string.Empty); 69 70 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h4"); 71 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 72 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 73 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 74 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity} m-0\">"; 75 string headingLevelStop = $"</{headingLevel}>"; 76 77 string textColor = Model.Item.GetString("TextColor", "text-inherit"); 78 string textOpacity = Model.Item.GetString("TextOpacity", "opacity-100"); 79 } 80 81 <div class="h-100 @(contentPadding)@(theme) @(css) item_@Model.Item.SystemName.ToLower()"> 82 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 83 @if (!string.IsNullOrEmpty(Model.Item.GetString("Link"))) 84 { 85 @:<a href="@Model.Item.GetString("Link")" class="text-decoration-none d-block h-100" @target @rel> 86 } 87 88 @switch (layout) 89 { 90 case "icon-top": 91 <div class="d-flex flex-column gap-3 text-center mb-0-last-child"> 92 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 93 {<div class="@flexGrowClass"> 94 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 95 { 96 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 97 } 98 else 99 { 100 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 101 } 102 </div> 103 } 104 105 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 106 { 107 <div class="mb-0-last-child"> 108 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 109 { 110 @headingLevelStart 111 @Model.Item.GetString("Title") 112 @headingLevelStop 113 } 114 115 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 116 { 117 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 118 } 119 </div> 120 } 121 </div> 122 break; 123 case "icon-left": 124 <div class="d-flex flex-row gap-3 h-100 text-start @alignment"> 125 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 126 {<div class="@flexGrowClass"> 127 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 128 { 129 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 130 } 131 else 132 { 133 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 134 } 135 </div> 136 } 137 138 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 139 { 140 <div class="d-flex flex-column flex-grow-1"> 141 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 142 { 143 @headingLevelStart 144 @Model.Item.GetString("Title") 145 @headingLevelStop 146 } 147 148 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 149 { 150 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 151 } 152 </div> 153 } 154 155 </div> 156 break; 157 case "icon-right": 158 <div class="d-flex flex-row gap-3 h-100 text-end @alignment"> 159 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 160 { 161 <div class="d-flex flex-column flex-grow-1"> 162 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 163 { 164 @headingLevelStart 165 @Model.Item.GetString("Title") 166 @headingLevelStop 167 } 168 169 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 170 { 171 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 172 } 173 </div> 174 } 175 176 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 177 {<div class="@flexGrowClass"> 178 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 179 { 180 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 181 } 182 else 183 { 184 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 185 } 186 </div> 187 } 188 </div> 189 break; 190 } 191 192 @if (!string.IsNullOrEmpty(Model.Item.GetString("Link"))) 193 { 194 @:</a> 195 } 196 </div> 197
Error executing template "Designs/Swift/Paragraph/Swift_Feature.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7707c8a0ef864297931f9e5582f29acd.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.IO 3 4 @functions 5 { 6 private string RenderCustomCSS(IEnumerable<string> decorations) 7 { 8 var cssClasses = new List<string>(); 9 10 foreach (var itemId in decorations) 11 { 12 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 13 item.TryGetValue("Class", out object classes); 14 15 if (classes is null) 16 { 17 continue; 18 } 19 20 var cssString = (string)classes; 21 22 if (cssString.StartsWith("[")) 23 { 24 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 25 cssClasses.AddRange(cssArray); 26 } 27 else 28 { 29 cssClasses.Add(cssString.Replace(",", " ")); 30 } 31 } 32 33 return string.Join(" ", cssClasses).Trim(); 34 } 35 } 36 37 @{ 38 string layout = Model.Item.GetRawValueString("Layout", "icon-top"); 39 string contentPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 40 contentPadding = contentPadding == "none" ? "" : contentPadding; 41 contentPadding = contentPadding == "small" ? "p-3 p-md-3" : contentPadding; 42 contentPadding = contentPadding == "large" ? "p-5 p-md-5" : contentPadding; 43 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 44 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 45 string css = RenderCustomCSS(decorations); 46 47 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && Model.Item.GetString("Link").Contains("http") ? "target=\"_blank\"" : string.Empty; 48 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && Model.Item.GetString("Link").Contains("http") ? "rel=\"noopener\"" : string.Empty; 49 string alignment = (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) && !string.IsNullOrEmpty(Model.Item.GetString("Text")) ? "align-items-stretch" : "align-items-center"; 50 51 string iconColor = Model.Item.GetString("iconColor", "text-inherit"); 52 string iconOpacity = Model.Item.GetString("IconOpacity", "opacity-100"); 53 54 string iconSize = Model.Item.GetRawValueString("IconSize", "2"); 55 string imageSrc = !string.IsNullOrEmpty(Model.Item.GetString("Image")) ? Model.Item.GetFile("Image").Path : string.Empty; 56 string flexGrowClass = string.Empty; 57 58 switch (layout) 59 { 60 case "icon-left": 61 case "icon-right": 62 flexGrowClass = "flex-grow-0"; 63 break; 64 } 65 66 string imagePath = imageSrc != string.Empty ? imageSrc : Model.Item.GetRawValueString("Icon", string.Empty); 67 imagePath = Path.GetExtension(imagePath).ToLower() != ".svg" ? "/Admin/Public/GetImage.ashx?image=" + imagePath + "&height=" + iconSize + "&width=" + iconSize + "&Crop=0&format=webp" : imagePath; 68 string imgAltText = Model.Item.GetRawValueString("FeatureAltText", string.Empty); 69 70 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h4"); 71 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 72 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 73 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 74 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity} m-0\">"; 75 string headingLevelStop = $"</{headingLevel}>"; 76 77 string textColor = Model.Item.GetString("TextColor", "text-inherit"); 78 string textOpacity = Model.Item.GetString("TextOpacity", "opacity-100"); 79 } 80 81 <div class="h-100 @(contentPadding)@(theme) @(css) item_@Model.Item.SystemName.ToLower()"> 82 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 83 @if (!string.IsNullOrEmpty(Model.Item.GetString("Link"))) 84 { 85 @:<a href="@Model.Item.GetString("Link")" class="text-decoration-none d-block h-100" @target @rel> 86 } 87 88 @switch (layout) 89 { 90 case "icon-top": 91 <div class="d-flex flex-column gap-3 text-center mb-0-last-child"> 92 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 93 {<div class="@flexGrowClass"> 94 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 95 { 96 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 97 } 98 else 99 { 100 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 101 } 102 </div> 103 } 104 105 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 106 { 107 <div class="mb-0-last-child"> 108 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 109 { 110 @headingLevelStart 111 @Model.Item.GetString("Title") 112 @headingLevelStop 113 } 114 115 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 116 { 117 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 118 } 119 </div> 120 } 121 </div> 122 break; 123 case "icon-left": 124 <div class="d-flex flex-row gap-3 h-100 text-start @alignment"> 125 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 126 {<div class="@flexGrowClass"> 127 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 128 { 129 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 130 } 131 else 132 { 133 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 134 } 135 </div> 136 } 137 138 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 139 { 140 <div class="d-flex flex-column flex-grow-1"> 141 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 142 { 143 @headingLevelStart 144 @Model.Item.GetString("Title") 145 @headingLevelStop 146 } 147 148 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 149 { 150 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 151 } 152 </div> 153 } 154 155 </div> 156 break; 157 case "icon-right": 158 <div class="d-flex flex-row gap-3 h-100 text-end @alignment"> 159 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 160 { 161 <div class="d-flex flex-column flex-grow-1"> 162 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 163 { 164 @headingLevelStart 165 @Model.Item.GetString("Title") 166 @headingLevelStop 167 } 168 169 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 170 { 171 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 172 } 173 </div> 174 } 175 176 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 177 {<div class="@flexGrowClass"> 178 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 179 { 180 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 181 } 182 else 183 { 184 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 185 } 186 </div> 187 } 188 </div> 189 break; 190 } 191 192 @if (!string.IsNullOrEmpty(Model.Item.GetString("Link"))) 193 { 194 @:</a> 195 } 196 </div> 197
Error executing template "Designs/Swift/Paragraph/Swift_Feature.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7707c8a0ef864297931f9e5582f29acd.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.IO 3 4 @functions 5 { 6 private string RenderCustomCSS(IEnumerable<string> decorations) 7 { 8 var cssClasses = new List<string>(); 9 10 foreach (var itemId in decorations) 11 { 12 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 13 item.TryGetValue("Class", out object classes); 14 15 if (classes is null) 16 { 17 continue; 18 } 19 20 var cssString = (string)classes; 21 22 if (cssString.StartsWith("[")) 23 { 24 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 25 cssClasses.AddRange(cssArray); 26 } 27 else 28 { 29 cssClasses.Add(cssString.Replace(",", " ")); 30 } 31 } 32 33 return string.Join(" ", cssClasses).Trim(); 34 } 35 } 36 37 @{ 38 string layout = Model.Item.GetRawValueString("Layout", "icon-top"); 39 string contentPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 40 contentPadding = contentPadding == "none" ? "" : contentPadding; 41 contentPadding = contentPadding == "small" ? "p-3 p-md-3" : contentPadding; 42 contentPadding = contentPadding == "large" ? "p-5 p-md-5" : contentPadding; 43 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 44 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 45 string css = RenderCustomCSS(decorations); 46 47 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && Model.Item.GetString("Link").Contains("http") ? "target=\"_blank\"" : string.Empty; 48 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && Model.Item.GetString("Link").Contains("http") ? "rel=\"noopener\"" : string.Empty; 49 string alignment = (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) && !string.IsNullOrEmpty(Model.Item.GetString("Text")) ? "align-items-stretch" : "align-items-center"; 50 51 string iconColor = Model.Item.GetString("iconColor", "text-inherit"); 52 string iconOpacity = Model.Item.GetString("IconOpacity", "opacity-100"); 53 54 string iconSize = Model.Item.GetRawValueString("IconSize", "2"); 55 string imageSrc = !string.IsNullOrEmpty(Model.Item.GetString("Image")) ? Model.Item.GetFile("Image").Path : string.Empty; 56 string flexGrowClass = string.Empty; 57 58 switch (layout) 59 { 60 case "icon-left": 61 case "icon-right": 62 flexGrowClass = "flex-grow-0"; 63 break; 64 } 65 66 string imagePath = imageSrc != string.Empty ? imageSrc : Model.Item.GetRawValueString("Icon", string.Empty); 67 imagePath = Path.GetExtension(imagePath).ToLower() != ".svg" ? "/Admin/Public/GetImage.ashx?image=" + imagePath + "&height=" + iconSize + "&width=" + iconSize + "&Crop=0&format=webp" : imagePath; 68 string imgAltText = Model.Item.GetRawValueString("FeatureAltText", string.Empty); 69 70 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h4"); 71 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 72 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 73 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 74 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity} m-0\">"; 75 string headingLevelStop = $"</{headingLevel}>"; 76 77 string textColor = Model.Item.GetString("TextColor", "text-inherit"); 78 string textOpacity = Model.Item.GetString("TextOpacity", "opacity-100"); 79 } 80 81 <div class="h-100 @(contentPadding)@(theme) @(css) item_@Model.Item.SystemName.ToLower()"> 82 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 83 @if (!string.IsNullOrEmpty(Model.Item.GetString("Link"))) 84 { 85 @:<a href="@Model.Item.GetString("Link")" class="text-decoration-none d-block h-100" @target @rel> 86 } 87 88 @switch (layout) 89 { 90 case "icon-top": 91 <div class="d-flex flex-column gap-3 text-center mb-0-last-child"> 92 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 93 {<div class="@flexGrowClass"> 94 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 95 { 96 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 97 } 98 else 99 { 100 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 101 } 102 </div> 103 } 104 105 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 106 { 107 <div class="mb-0-last-child"> 108 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 109 { 110 @headingLevelStart 111 @Model.Item.GetString("Title") 112 @headingLevelStop 113 } 114 115 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 116 { 117 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 118 } 119 </div> 120 } 121 </div> 122 break; 123 case "icon-left": 124 <div class="d-flex flex-row gap-3 h-100 text-start @alignment"> 125 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 126 {<div class="@flexGrowClass"> 127 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 128 { 129 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 130 } 131 else 132 { 133 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 134 } 135 </div> 136 } 137 138 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 139 { 140 <div class="d-flex flex-column flex-grow-1"> 141 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 142 { 143 @headingLevelStart 144 @Model.Item.GetString("Title") 145 @headingLevelStop 146 } 147 148 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 149 { 150 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 151 } 152 </div> 153 } 154 155 </div> 156 break; 157 case "icon-right": 158 <div class="d-flex flex-row gap-3 h-100 text-end @alignment"> 159 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 160 { 161 <div class="d-flex flex-column flex-grow-1"> 162 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 163 { 164 @headingLevelStart 165 @Model.Item.GetString("Title") 166 @headingLevelStop 167 } 168 169 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 170 { 171 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 172 } 173 </div> 174 } 175 176 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 177 {<div class="@flexGrowClass"> 178 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 179 { 180 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 181 } 182 else 183 { 184 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 185 } 186 </div> 187 } 188 </div> 189 break; 190 } 191 192 @if (!string.IsNullOrEmpty(Model.Item.GetString("Link"))) 193 { 194 @:</a> 195 } 196 </div> 197
Error executing template "Designs/Swift/Paragraph/Swift_Feature.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7707c8a0ef864297931f9e5582f29acd.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.IO 3 4 @functions 5 { 6 private string RenderCustomCSS(IEnumerable<string> decorations) 7 { 8 var cssClasses = new List<string>(); 9 10 foreach (var itemId in decorations) 11 { 12 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 13 item.TryGetValue("Class", out object classes); 14 15 if (classes is null) 16 { 17 continue; 18 } 19 20 var cssString = (string)classes; 21 22 if (cssString.StartsWith("[")) 23 { 24 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 25 cssClasses.AddRange(cssArray); 26 } 27 else 28 { 29 cssClasses.Add(cssString.Replace(",", " ")); 30 } 31 } 32 33 return string.Join(" ", cssClasses).Trim(); 34 } 35 } 36 37 @{ 38 string layout = Model.Item.GetRawValueString("Layout", "icon-top"); 39 string contentPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 40 contentPadding = contentPadding == "none" ? "" : contentPadding; 41 contentPadding = contentPadding == "small" ? "p-3 p-md-3" : contentPadding; 42 contentPadding = contentPadding == "large" ? "p-5 p-md-5" : contentPadding; 43 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 44 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 45 string css = RenderCustomCSS(decorations); 46 47 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && Model.Item.GetString("Link").Contains("http") ? "target=\"_blank\"" : string.Empty; 48 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && Model.Item.GetString("Link").Contains("http") ? "rel=\"noopener\"" : string.Empty; 49 string alignment = (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) && !string.IsNullOrEmpty(Model.Item.GetString("Text")) ? "align-items-stretch" : "align-items-center"; 50 51 string iconColor = Model.Item.GetString("iconColor", "text-inherit"); 52 string iconOpacity = Model.Item.GetString("IconOpacity", "opacity-100"); 53 54 string iconSize = Model.Item.GetRawValueString("IconSize", "2"); 55 string imageSrc = !string.IsNullOrEmpty(Model.Item.GetString("Image")) ? Model.Item.GetFile("Image").Path : string.Empty; 56 string flexGrowClass = string.Empty; 57 58 switch (layout) 59 { 60 case "icon-left": 61 case "icon-right": 62 flexGrowClass = "flex-grow-0"; 63 break; 64 } 65 66 string imagePath = imageSrc != string.Empty ? imageSrc : Model.Item.GetRawValueString("Icon", string.Empty); 67 imagePath = Path.GetExtension(imagePath).ToLower() != ".svg" ? "/Admin/Public/GetImage.ashx?image=" + imagePath + "&height=" + iconSize + "&width=" + iconSize + "&Crop=0&format=webp" : imagePath; 68 string imgAltText = Model.Item.GetRawValueString("FeatureAltText", string.Empty); 69 70 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h4"); 71 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 72 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 73 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 74 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity} m-0\">"; 75 string headingLevelStop = $"</{headingLevel}>"; 76 77 string textColor = Model.Item.GetString("TextColor", "text-inherit"); 78 string textOpacity = Model.Item.GetString("TextOpacity", "opacity-100"); 79 } 80 81 <div class="h-100 @(contentPadding)@(theme) @(css) item_@Model.Item.SystemName.ToLower()"> 82 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 83 @if (!string.IsNullOrEmpty(Model.Item.GetString("Link"))) 84 { 85 @:<a href="@Model.Item.GetString("Link")" class="text-decoration-none d-block h-100" @target @rel> 86 } 87 88 @switch (layout) 89 { 90 case "icon-top": 91 <div class="d-flex flex-column gap-3 text-center mb-0-last-child"> 92 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 93 {<div class="@flexGrowClass"> 94 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 95 { 96 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 97 } 98 else 99 { 100 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 101 } 102 </div> 103 } 104 105 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 106 { 107 <div class="mb-0-last-child"> 108 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 109 { 110 @headingLevelStart 111 @Model.Item.GetString("Title") 112 @headingLevelStop 113 } 114 115 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 116 { 117 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 118 } 119 </div> 120 } 121 </div> 122 break; 123 case "icon-left": 124 <div class="d-flex flex-row gap-3 h-100 text-start @alignment"> 125 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 126 {<div class="@flexGrowClass"> 127 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 128 { 129 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 130 } 131 else 132 { 133 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 134 } 135 </div> 136 } 137 138 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 139 { 140 <div class="d-flex flex-column flex-grow-1"> 141 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 142 { 143 @headingLevelStart 144 @Model.Item.GetString("Title") 145 @headingLevelStop 146 } 147 148 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 149 { 150 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 151 } 152 </div> 153 } 154 155 </div> 156 break; 157 case "icon-right": 158 <div class="d-flex flex-row gap-3 h-100 text-end @alignment"> 159 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle") || !string.IsNullOrEmpty(Model.Item.GetString("Text"))) 160 { 161 <div class="d-flex flex-column flex-grow-1"> 162 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 163 { 164 @headingLevelStart 165 @Model.Item.GetString("Title") 166 @headingLevelStop 167 } 168 169 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 170 { 171 <p class="@textColor @textOpacity m-0">@Model.Item.GetString("Text")</p> 172 } 173 </div> 174 } 175 176 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image")) || !imagePath.ToLower().Contains("none") && imagePath != string.Empty) 177 {<div class="@flexGrowClass"> 178 @if (Path.GetExtension(imagePath).ToLower() == ".svg") 179 { 180 <div class="icon-auto @iconColor @iconOpacity" style="height: @(iconSize)px; width: @(iconSize)px;">@ReadFile(imagePath)</div> 181 } 182 else 183 { 184 <img loading="lazy" src="@imagePath" alt="@imgAltText" title="@Model.Item.GetString("Title")" style="height: @(iconSize)px; width: @(iconSize)px;"> 185 } 186 </div> 187 } 188 </div> 189 break; 190 } 191 192 @if (!string.IsNullOrEmpty(Model.Item.GetString("Link"))) 193 { 194 @:</a> 195 } 196 </div> 197

Title (h2)

Subtitle (h3)

Your text comes here.

Adjust spacing (left, right, top & bottom) in content settings to your likings.

Related products

Title (h2)

Subtitle (h3)

Your text comes here.

Adjust spacing (left, right, top & bottom) in content settings to your likings.

Related customer cases

Related software for various industries

SOFTWARE FOR

(industry)

SOFTWARE FOR

(industry)

SOFTWARE FOR

(industry)

SOFTWARE FOR

(industry)

SOFTWARE FOR

(industry)

SOFTWARE FOR

(industry)

Why choose 9altitudes as your software partner?

9altitudes is a European digital partner that automates, optimizes, and continuously improves business processes end-to-end. We help manufacturing, supply chain, and service companies reach new heights by leveraging Microsoft, PTC, and Tulip software combined with our own industry-specific solutions.

With team members from 9 different countries, our team consists of 750 exceptionally talented experts. Our high-end consultants are relentless in their pursuit of innovation, dedicated to creating exceptional customer experiences and delivering impactful solutions.

Choosing an ERP solution tailored to your specific industry offers numerous advantages. A solid foundation is essential. At 9altitudes, we combine the best of both worlds: integrating proven platforms like Microsoft Dynamics 365 Finance, Supply Chain Management, and Business Central with industry best practices.

Fill in your title

Fill in your subtitle (optional)

Fill out some text and adjust styling options of your row and paragraph to have other colors

Pricing: What to expect for your business?

Our job is to simplify your journey to the summit, ensuring a smoother climb to new heights where you continuously feel safeguarded and in control. That's exactly why we've made it possible for you to obtain a high-level budget estimation already.

How? By completing this guiding questionnaire, we can estimate the project implementation investment and the monthly Microsoft license estimate, based on our experience in implementing many projects like the one you envision.

Related articles

Get in touch

Digital business transformation is what we do. Making sure organizations are ready to deliver for the end customer of today and those of tomorrow. Thanks to our industry expertise, we are able to combine speed and quality into your digital transformation journey.