Error executing template "Designs/Swift/Paragraph/Swift_Poster.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_2d4c601591654cd4b5cff3cc043b3dba.RenderCustomCSS(IEnumerable`1 decorations) in G:\Domains\Sites\uat-qmx.mydwsite5.com\Files\Templates\Designs\Swift\Paragraph\Swift_Poster.cshtml:line 13
   at CompiledRazorTemplates.Dynamic.RazorEngine_2d4c601591654cd4b5cff3cc043b3dba.Execute() in G:\Domains\Sites\uat-qmx.mydwsite5.com\Files\Templates\Designs\Swift\Paragraph\Swift_Poster.cshtml:line 220
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   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 Dynamicweb.Ecommerce.ProductCatalog 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 bool movePageBehind = false; 39 bool isFirstPoster = false; 40 string movePageBehindClass = string.Empty; 41 42 if (Pageview.Page.PropertyItem != null) 43 { 44 string headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; 45 movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false; 46 if (movePageBehind) 47 { 48 movePageBehindClass = " poster-behind"; 49 if (!Dynamicweb.Context.Current.Items.Contains("firstPosterIsRendered")) 50 { 51 isFirstPoster = true; 52 Dynamicweb.Context.Current.Items.Add("firstPosterIsRendered", true); 53 } 54 } 55 } 56 57 bool hideTitle = Model.Item?.GetBoolean("HideTitle") ?? false; 58 string title = !hideTitle ? Model.Item.GetString("Title", string.Empty) : string.Empty; 59 60 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-1"); 61 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 62 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 63 64 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 65 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 66 string subtitleOpacity = Model.Item.GetString("SubtitleOpacity", "opacity-100"); 67 68 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 69 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity} mb-0\">"; 70 string headingLevelStop = $"</{headingLevel}>"; 71 72 //Link generation 73 Dynamicweb.Frontend.LinkViewModel link = new Dynamicweb.Frontend.LinkViewModel(); 74 Dynamicweb.Frontend.LinkViewModel link2 = new Dynamicweb.Frontend.LinkViewModel(); 75 76 string linkType = Model.Item.GetRawValueString("LinkType", "page"); 77 string linkType2 = Model.Item.GetRawValueString("LinkType2", "page2"); 78 79 if (linkType == "page" && Model.Item.GetLink("ButtonLink") != null) 80 { 81 link = Model.Item.GetLink("ButtonLink"); 82 } 83 84 if (linkType2 == "page2" && Model.Item.GetLink("ButtonLink2") != null) 85 { 86 link2 = Model.Item.GetLink("ButtonLink2"); 87 } 88 89 if (linkType == "product-group") 90 { 91 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink"); 92 IList<string> groupIds = new List<string> { }; 93 94 if (selectedGroups != null) 95 { 96 foreach (var fromGroup in selectedGroups) 97 { 98 groupIds.Add(fromGroup.Id); 99 } 100 } 101 102 link = new Dynamicweb.Frontend.LinkViewModel() 103 { 104 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 105 IsExternal = false 106 }; 107 } 108 109 if (linkType2 == "product-group2") 110 { 111 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink2"); 112 IList<string> groupIds = new List<string> { }; 113 114 if (selectedGroups != null) 115 { 116 foreach (var fromGroup in selectedGroups) 117 { 118 groupIds.Add(fromGroup.Id); 119 } 120 } 121 122 link2 = new Dynamicweb.Frontend.LinkViewModel() 123 { 124 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 125 IsExternal = false 126 }; 127 } 128 129 if (linkType == "product") 130 { 131 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink"); 132 IList<string> productIds = new List<string> { }; 133 134 if (products != null && products.Products.Any()) 135 { 136 foreach (var product in products.Products) 137 { 138 productIds.Add(product.Id); 139 } 140 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 141 string productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 142 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 143 144 link = new Dynamicweb.Frontend.LinkViewModel() 145 { 146 Url = productLink, 147 IsExternal = false 148 }; 149 } 150 } 151 152 if (linkType == "product2") 153 { 154 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink2"); 155 IList<string> productIds = new List<string> { }; 156 157 if (products != null && products.Products.Any()) 158 { 159 foreach (var product in products.Products) 160 { 161 productIds.Add(product.Id); 162 } 163 164 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 165 string productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 166 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 167 168 link2 = new Dynamicweb.Frontend.LinkViewModel() 169 { 170 Url = productLink, 171 IsExternal = false 172 }; 173 } 174 } 175 176 //Buttons setup 177 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : string.Empty; 178 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : string.Empty; 179 180 string buttonSize = Model.Item.GetRawValueString("ButtonSize", "regular"); 181 buttonSize = buttonSize == "small" ? " btn-sm" : buttonSize; 182 buttonSize = buttonSize == "regular" ? string.Empty : buttonSize; 183 buttonSize = buttonSize == "large" ? " btn-lg" : buttonSize; 184 185 //Button 1 186 string buttonStyle = Model.Item.GetRawValueString("ButtonStyle", "primary"); 187 buttonStyle = buttonStyle == "primary" ? " btn-primary" : buttonStyle; 188 buttonStyle = buttonStyle == "secondary" ? " btn-secondary" : buttonStyle; 189 buttonStyle = buttonStyle == "link" ? " btn-link" : buttonStyle; 190 string buttonLabel = Model.Item.GetString("ButtonLabel", string.Empty); 191 string stretchedLink = Model.Item.GetRawValueString("StretchedLink", "column-not-clickable"); 192 string stretchedLinkClass = stretchedLink == "column-clickable" && string.IsNullOrEmpty(link2.Url) && string.IsNullOrEmpty(buttonLabel) ? " stretched-link" : string.Empty; 193 194 //Button 2 195 string buttonStyle2 = Model.Item.GetRawValueString("ButtonStyle2", "secondary"); 196 buttonStyle2 = buttonStyle2 == "primary" ? " btn-primary" : buttonStyle2; 197 buttonStyle2 = buttonStyle2 == "secondary" ? " btn-secondary" : buttonStyle2; 198 buttonStyle2 = buttonStyle2 == "link" ? " btn-link" : buttonStyle2; 199 string buttonLabel2 = Model.Item.GetString("ButtonLabel2", string.Empty); 200 string stretchedLink2 = Model.Item.GetRawValueString("StretchedLink2", "column-not-clickable"); 201 string stretchedLinkClass2 = stretchedLink2 == "column-clickable" && string.IsNullOrEmpty(link.Url) && string.IsNullOrEmpty(buttonLabel2) ? " stretched-link" : string.Empty; 202 203 //Image 204 string image = Model.Item.GetString("Image", string.Empty); 205 string imgAltText = Model.Item.GetString("PosterAltText", string.Empty); 206 string imageFilter = Model.Item.GetRawValueString("ImageFilter", string.Empty) == "filter" ? "image-filter" : string.Empty; 207 208 int xPos = Model.Item?.GetFile("Image")?.FocalPositionFromLeft ?? 50; 209 int yPos = Model.Item?.GetFile("Image")?.FocalPositionFromTop ?? 50; 210 211 var parms = new Dictionary<string, object>(); 212 parms.Add("columns", Model.GridRowColumnCount); 213 parms.Add("alt", imgAltText); 214 parms.Add("quality", 90); 215 216 //General layout and styling 217 string maxWidth = Model.Item.GetRawValueString("TextReadability", string.Empty) == "max-width-on" ? "mw-75ch d-inline-block" : string.Empty; 218 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", string.Empty).Trim().ToLower() : string.Empty; 219 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 220 string css = RenderCustomCSS(decorations); 221 222 string posterPaddingClass = string.Empty; 223 string posterPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 224 posterPaddingClass = posterPadding == "none" ? " p-3 px-xl-3 py-xl-4" : posterPaddingClass; 225 posterPaddingClass = posterPadding == "small" ? " p-3 p-xl-4" : posterPaddingClass; 226 posterPaddingClass = posterPadding == "large" ? " p-4 p-xl-5" : posterPaddingClass; 227 228 string posterHeightClass = string.Empty; 229 string posterHeight = Model.Item.GetRawValueString("PosterHeight", "large"); 230 posterHeightClass = posterHeight == "small" ? " min-vh-25 min-vh-md-50" : posterHeightClass; 231 posterHeightClass = posterHeight == "medium" ? " min-vh-50 min-vh-md-75" : posterHeightClass; 232 posterHeightClass = posterHeight == "large" ? " min-vh-75 min-vh-md-100" : posterHeightClass; 233 234 string posterSizeBase = posterHeight.Contains("%") || posterHeight.Contains("0") ? "aspect-ratio" : "height"; 235 236 string ratio = Model.Item.GetRawValueString("PosterHeight", string.Empty); 237 ratio = ratio != "0" ? ratio : string.Empty; 238 string ratioCssClass = ratio != string.Empty ? "ratio" : string.Empty; 239 string ratioVariable = ratio != string.Empty ? "style=\"--bs-aspect-ratio: " + ratio + "\"" : string.Empty; 240 241 string layout = Model.Item.GetRawValueString("Layout", "align-middle-center-text-center"); 242 243 string alignment = string.Empty; 244 switch (layout) 245 { 246 case "align-top-left-text-left": 247 alignment = " text-start justify-content-start align-items-start"; 248 break; 249 case "align-top-center-text-center": 250 alignment = " text-center justify-content-start align-items-center"; 251 break; 252 case "align-top-right-text-right": 253 alignment = " text-end justify-content-start align-items-end"; 254 break; 255 case "align-middle-left-text-left": 256 alignment = " text-start justify-content-center align-items-start"; 257 break; 258 case "align-middle-center-text-center": 259 alignment = " text-center justify-content-center align-items-center"; 260 break; 261 case "align-middle-right-text-right": 262 alignment = " text-end justify-content-center align-items-end"; 263 break; 264 case "align-bottom-left-text-left": 265 alignment = " text-start justify-content-end align-items-start"; 266 break; 267 case "align-bottom-center-text-center": 268 alignment = " text-center justify-content-end align-items-center"; 269 break; 270 case "align-bottom-right-text-right": 271 alignment = " text-end justify-content-end align-items-end"; 272 break; 273 } 274 275 //Container classes for each size + if there is an image 276 string noImageRatioCssClass = posterSizeBase == "aspect-ratio" && string.IsNullOrEmpty(Model.Item.GetString("Image")) ? ratioCssClass : "h-100"; 277 string noImageRatioVariable = posterSizeBase == "aspect-ratio" && string.IsNullOrEmpty(Model.Item.GetString("Image")) ? ratioVariable : string.Empty; 278 279 string containerCssClasses = posterSizeBase == "height" ? "container-xl px-0" : string.Empty; 280 containerCssClasses = posterSizeBase == "aspect-ratio" && string.IsNullOrEmpty(Model.Item.GetString("Image")) ? $"container-xl px-0 {noImageRatioCssClass}" : containerCssClasses; 281 containerCssClasses = posterSizeBase == "aspect-ratio" && !string.IsNullOrEmpty(Model.Item.GetString("Image")) ? "position-absolute top-0 bottom-0 end-0 start-0" : containerCssClasses; 282 283 string containerInnerCssClasses = posterSizeBase == "height" ? "position-relative" : string.Empty; 284 containerInnerCssClasses = posterSizeBase == "aspect-ratio" && string.IsNullOrEmpty(Model.Item.GetString("Image")) ? "container-xl" : containerInnerCssClasses; 285 containerInnerCssClasses = posterSizeBase == "aspect-ratio" && !string.IsNullOrEmpty(Model.Item.GetString("Image")) ? "container-xl" : containerInnerCssClasses; 286 } 287 288 <div class="position-relative@(theme)@(movePageBehindClass) @(css) item_@Model.Item.SystemName.ToLower()"> 289 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top:var(--header-height,150px)"></div> 290 291 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image"))) 292 { 293 if (!string.IsNullOrEmpty(image)) 294 { 295 if (posterSizeBase == "height") 296 { 297 parms.Add("cssClass", "h-100 w-100"); 298 299 <div class="position-absolute top-0 bottom-0 end-0 start-0 @(imageFilter)"> 300 @RenderPartial("Components/Image.cshtml", Model.Item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms) 301 </div> 302 } 303 304 if (posterSizeBase == "aspect-ratio") 305 { 306 if (ratio == string.Empty) 307 { 308 parms.Add("cssClass", "w-100 mh-100 mw-100"); 309 parms.Add("fullwidth", true); 310 } 311 312 <figure class="m-0 @(imageFilter) @(ratioCssClass)" @ratioVariable> 313 @RenderPartial("Components/Image.cshtml", Model.Item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms) 314 </figure> 315 } 316 } 317 } 318 319 @if ( 320 !string.IsNullOrEmpty(Model.Item.GetString("Title")) || 321 Model.Item?.GetBoolean("HideTitle") == false || 322 !string.IsNullOrEmpty(Model.Item.GetString("Text")) || 323 link != null && !string.IsNullOrEmpty(link.Url) || 324 link2 != null && !string.IsNullOrEmpty(link2.Url)) 325 { 326 <div class="@containerCssClasses" @ratioVariable> 327 <div class="h-100 d-flex flex-column gap-3 gap-md-4@(posterPaddingClass)@(alignment)@(posterHeightClass) @(containerInnerCssClasses)" id="Poster_@Pageview.CurrentParagraph.ID"> 328 @if (!string.IsNullOrEmpty(title)) 329 { 330 @headingLevelStart 331 <span class="@maxWidth">@title</span> 332 @headingLevelStop 333 } 334 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 335 { 336 <p class="@subtitleFontSize @(subtitleColor) @(subtitleOpacity) lead mb-0"> 337 <span class="@maxWidth">@Model.Item.GetString("Text")</span> 338 </p> 339 } 340 @if (link != null && !string.IsNullOrEmpty(link.Url) || link2 != null && !string.IsNullOrEmpty(link2.Url)) 341 { 342 if ((link != null && !string.IsNullOrEmpty(link.Url)) && (link2 != null && !string.IsNullOrEmpty(link2.Url))) { 343 @:<div class="d-flex flex-wrap gap-3@(alignment)"> 344 } 345 346 if (link != null && !string.IsNullOrEmpty(link.Url)) 347 { 348 if (!string.IsNullOrEmpty(buttonLabel)) 349 { 350 <a href="@link.Url" @target @rel class="text-nowrap btn@(buttonStyle)@(buttonSize)@(stretchedLinkClass)">@buttonLabel</a> 351 } 352 else 353 { 354 <a href="@link.Url" @target @rel class="@(!string.IsNullOrEmpty(stretchedLinkClass) ? "position-absolute top-0 bottom-0 start-0 end-0" : stretchedLinkClass)"> 355 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 356 </a> 357 } 358 } 359 360 if (link2 != null && !string.IsNullOrEmpty(link2.Url)) 361 { 362 if (!string.IsNullOrEmpty(buttonLabel2)) 363 { 364 <a href="@link2.Url" @target @rel class="text-nowrap btn@(buttonStyle2)@(buttonSize)@(stretchedLinkClass2)">@buttonLabel2</a> 365 } 366 else 367 { 368 <a href="@link2.Url" @target @rel class="@(!string.IsNullOrEmpty(stretchedLinkClass2) ? "position-absolute top-0 bottom-0 start-0 end-0" : stretchedLinkClass2)"> 369 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 370 </a> 371 } 372 } 373 374 if ((link != null && !string.IsNullOrEmpty(link.Url)) && (link2 != null && !string.IsNullOrEmpty(link2.Url))) { 375 @:</div> 376 } 377 } 378 </div> 379 </div> 380 } 381 </div> 382 383 @if (movePageBehind && isFirstPoster) 384 { 385 <script> 386 ['resize', 'load'].forEach(function (e) { 387 window.addEventListener(e, () => swift.Scroll.setContentPosition()); 388 }); 389 </script> 390 } 391
Error executing template "Designs/Swift/Paragraph/Swift_TextAdvanced.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_66b0f3e7120d4388b72c8017b5fd214b.RenderCustomCSS(IEnumerable`1 decorations) in G:\Domains\Sites\uat-qmx.mydwsite5.com\Files\Templates\Designs\Swift\Paragraph\Swift_TextAdvanced.cshtml:line 28
   at CompiledRazorTemplates.Dynamic.RazorEngine_66b0f3e7120d4388b72c8017b5fd214b.Execute() in G:\Domains\Sites\uat-qmx.mydwsite5.com\Files\Templates\Designs\Swift\Paragraph\Swift_TextAdvanced.cshtml:line 56
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   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 3 @functions 4 { 5 private string RenderContent(string content, string heading, string fontSize, string color, string opacity, string margin, string marginMobile, string cssClass) 6 { 7 var classes = new List<string> { }; 8 if (!string.IsNullOrEmpty(fontSize)) { classes.Add(fontSize); } 9 if (!string.IsNullOrEmpty(color)) { classes.Add(color); } 10 if (!string.IsNullOrEmpty(opacity)) { classes.Add(opacity); } 11 if (!string.IsNullOrEmpty(margin)) { classes.Add(margin); } 12 if (!string.IsNullOrEmpty(marginMobile)) { classes.Add(marginMobile); } 13 if (!string.IsNullOrEmpty(cssClass)) { classes.Add(cssClass); } 14 15 var tagStart = $"<{heading} class=\"{string.Join(" ", classes)}\">"; 16 var tagEnd = $"</{heading}>"; 17 18 return tagStart + content + tagEnd; 19 } 20 21 string RenderCustomCSS(IEnumerable<string> decorations) 22 { 23 var cssClasses = new List<string>(); 24 25 foreach (var itemId in decorations) 26 { 27 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 28 item.TryGetValue("Class", out object classes); 29 30 if (classes is null) 31 { 32 continue; 33 } 34 35 var cssString = (string)classes; 36 37 if (cssString.StartsWith("[")) 38 { 39 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 40 cssClasses.AddRange(cssArray); 41 } 42 else 43 { 44 cssClasses.Add(cssString.Replace(",", " ")); 45 } 46 } 47 48 return string.Join(" ", cssClasses).Trim(); 49 } 50 } 51 52 @{ 53 54 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? $" theme {Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower()}" : ""; 55 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 56 string css = RenderCustomCSS(decorations); 57 58 string eyebrow = Model.Item.GetString("Eyebrow", string.Empty).Replace(System.Environment.NewLine, "<br>"); 59 string eyebrowHeadingLevel = Model.Item.GetString("EyebrowHeadingLevel", "h3"); 60 string eyebrowFontSize = Model.Item.GetRawValueString("EyebrowFontSize", "h5"); 61 string eyebrowColor = Model.Item.GetString("EyebrowColor", "text-inherit"); 62 string eyebrowTextOpacity = Model.Item.GetString("EyebrowTextOpacity", "opacity-100"); 63 string eyebrowCssClass = Model.Item.GetString("EyebrowCssClass", string.Empty); 64 string eyebrowSpacingBottomDesktop = Model.Item.GetRawValueString("EyebrowSpacingBottomDesktop", "default"); 65 eyebrowSpacingBottomDesktop = eyebrowSpacingBottomDesktop != "default" ? eyebrowSpacingBottomDesktop : string.Empty; 66 string eyebrowSpacingBottomMobile = Model.Item.GetRawValueString("EyebrowSpacingBottomMobile", "default"); 67 eyebrowSpacingBottomMobile = eyebrowSpacingBottomMobile != "default" ? eyebrowSpacingBottomMobile : string.Empty; 68 69 string title = Model.Item.GetString("Title", string.Empty).Replace(System.Environment.NewLine, "<br>"); 70 string titleHeadingLevel = Model.Item.GetString("TitleHeadingLevel", "h2"); 71 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h2"); 72 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 73 string titleTextOpacity = Model.Item.GetString("TitleTextOpacity", "opacity-100"); 74 string titleCssClass = Model.Item.GetString("TitleCssClass", string.Empty); 75 string titleSpacingBottomDesktop = Model.Item.GetRawValueString("TitleSpacingBottomDesktop", "default"); 76 titleSpacingBottomDesktop = titleSpacingBottomDesktop != "default" ? titleSpacingBottomDesktop : string.Empty; 77 string titleSpacingBottomMobile = Model.Item.GetRawValueString("TitleSpacingBottomMobile", "default"); 78 titleSpacingBottomMobile = titleSpacingBottomMobile != "default" ? titleSpacingBottomMobile : string.Empty; 79 80 string subtitle = Model.Item.GetString("Subtitle", string.Empty).Replace(System.Environment.NewLine, "<br>"); 81 string subtitleHeadingLevel = Model.Item.GetString("SubtitleHeadingLevel", "p"); 82 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 83 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 84 string subtitleTextOpacity = Model.Item.GetString("SubtitleTextOpacity", "opacity-100"); 85 string subtitleCssClass = Model.Item.GetString("SubtitleCssClass", string.Empty); 86 string subtitleSpacingBottomDesktop = Model.Item.GetRawValueString("SubtitleSpacingBottomDesktop", "default"); 87 subtitleSpacingBottomDesktop = subtitleSpacingBottomDesktop != "default" ? subtitleSpacingBottomDesktop : string.Empty; 88 string subtitleSpacingBottomMobile = Model.Item.GetRawValueString("SubtitleSpacingBottomMobile", "default"); 89 subtitleSpacingBottomMobile = subtitleSpacingBottomMobile != "default" ? subtitleSpacingBottomMobile : string.Empty; 90 91 string text = Model.Item.GetString("Text", string.Empty); 92 string textFontSize = Model.Item.GetRawValueString("TextFontSize", "fs-6"); 93 string textColor = Model.Item.GetString("TextColor", "text-inherit"); 94 string TextOpacity = Model.Item.GetString("TextOpacity", "opacity-100"); 95 string textCssClass = Model.Item.GetString("TextCssClass", string.Empty); 96 string textSpacingBottomDesktop = Model.Item.GetRawValueString("TextSpacingBottomDesktop", "mb-lg-4"); 97 textSpacingBottomDesktop = textSpacingBottomDesktop != "default" ? textSpacingBottomDesktop : string.Empty; 98 string textSpacingBottomMobile = Model.Item.GetRawValueString("TextSpacingBottomMobile", "mb-3"); 99 textSpacingBottomMobile = textSpacingBottomMobile != "default" ? textSpacingBottomMobile : string.Empty; 100 101 string contentAlignment = Model.Item.GetRawValueString("ContentAlignment", "align-items-center justify-content-center"); 102 string contentTextAlignment = Model.Item.GetRawValueString("ContentTextAlignment", "text-start"); 103 string contentSpacingStartDesktop = Model.Item.GetRawValueString("ContentSpacingStartDesktop", "default"); 104 contentSpacingStartDesktop = contentSpacingStartDesktop != "default" ? contentSpacingStartDesktop : string.Empty; 105 string contentSpacingStartMobile = Model.Item.GetRawValueString("ContentSpacingStartMobile", "default"); 106 contentSpacingStartMobile = contentSpacingStartMobile != "default" ? contentSpacingStartMobile : string.Empty; 107 string contentSpacingEndDesktop = Model.Item.GetRawValueString("ContentSpacingEndDesktop", "default"); 108 contentSpacingEndDesktop = contentSpacingEndDesktop != "default" ? contentSpacingEndDesktop : string.Empty; 109 string contentSpacingEndMobile = Model.Item.GetRawValueString("ContentSpacingEndMobile", "default"); 110 contentSpacingEndMobile = contentSpacingEndMobile != "default" ? contentSpacingEndMobile : string.Empty; 111 string contentSpacingTopDesktop = Model.Item.GetRawValueString("ContentSpacingTopDesktop", "default"); 112 contentSpacingTopDesktop = contentSpacingTopDesktop != "default" ? contentSpacingTopDesktop : string.Empty; 113 string contentSpacingTopMobile = Model.Item.GetRawValueString("ContentSpacingTopMobile", "default"); 114 contentSpacingTopMobile = contentSpacingTopMobile != "default" ? contentSpacingTopMobile : string.Empty; 115 string contentSpacingBottomDesktop = Model.Item.GetRawValueString("ContentSpacingBottomDesktop", "default"); 116 contentSpacingBottomDesktop = contentSpacingBottomDesktop != "default" ? contentSpacingBottomDesktop : string.Empty; 117 string contentSpacingBottomMobile = Model.Item.GetRawValueString("ContentSpacingBottomMobile", "default"); 118 contentSpacingBottomMobile = contentSpacingBottomMobile != "default" ? contentSpacingBottomMobile : string.Empty; 119 string contentCssClass = Model.Item.GetString("ContentCssClass", string.Empty); 120 121 var contentClasses = new List<string> { }; 122 if (contentSpacingStartDesktop != "default") { contentClasses.Add(contentSpacingStartDesktop.Trim()); } 123 if (contentSpacingStartMobile != "default") { contentClasses.Add(contentSpacingStartMobile.Trim()); } 124 if (contentSpacingEndDesktop != "default") { contentClasses.Add(contentSpacingEndDesktop.Trim()); } 125 if (contentSpacingEndMobile != "default") { contentClasses.Add(contentSpacingEndMobile.Trim()); } 126 if (contentSpacingTopDesktop != "default") { contentClasses.Add(contentSpacingTopDesktop.Trim()); } 127 if (contentSpacingTopMobile != "default") { contentClasses.Add(contentSpacingTopMobile.Trim()); } 128 if (contentSpacingBottomDesktop != "default") { contentClasses.Add(contentSpacingBottomDesktop.Trim()); } 129 if (contentSpacingBottomMobile != "default") { contentClasses.Add(contentSpacingBottomMobile.Trim()); } 130 if (!string.IsNullOrEmpty(contentCssClass)) { contentClasses.Add(contentCssClass); } 131 132 //Button 1 133 var button1Link = Model.Item.GetLink("Button1Link"); 134 var button1Label = Model.Item.GetString("Button1Label", string.Empty); 135 var button1Icon = Model.Item.GetRawValueString("Button1Icon"); 136 var button1IconPosition = Model.Item.GetRawValueString("Button1IconPosition", "right"); 137 var button1Style = Model.Item.GetRawValueString("Button1Style", "btn-primary"); 138 139 //Button 2 140 var button2Link = Model.Item.GetLink("Button2Link"); 141 var button2Label = Model.Item.GetString("Button2Label", string.Empty); 142 var button2Icon = Model.Item.GetRawValueString("Button2Icon"); 143 var button2IconPosition = Model.Item.GetRawValueString("Button2IconPosition", "right"); 144 var button2Style = Model.Item.GetRawValueString("Button2Style", "btn-primary"); 145 } 146 147 <div class="h-100 d-flex position-relative @(contentAlignment)@(theme) item_@Model.Item.SystemName.ToLower()"> 148 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top: var(--header-height, 150px)"></div> 149 <div class="d-inline-flex flex-column @(contentTextAlignment) @(string.Join(" ",contentClasses).Trim()) @(css)"> 150 151 @if (!string.IsNullOrEmpty(eyebrow)) 152 { 153 @RenderContent(eyebrow, eyebrowHeadingLevel, eyebrowFontSize, eyebrowColor, eyebrowTextOpacity, eyebrowSpacingBottomDesktop, eyebrowSpacingBottomMobile, eyebrowCssClass) 154 } 155 156 @if (!string.IsNullOrEmpty(title)) 157 { 158 @RenderContent(title, titleHeadingLevel, titleFontSize, titleColor, titleTextOpacity, titleSpacingBottomDesktop, titleSpacingBottomMobile, titleCssClass) 159 } 160 161 @if (!string.IsNullOrEmpty(subtitle)) 162 { 163 @RenderContent(subtitle, subtitleHeadingLevel, subtitleFontSize, subtitleColor, subtitleTextOpacity, subtitleSpacingBottomDesktop, subtitleSpacingBottomMobile, subtitleCssClass) 164 } 165 166 @if (!string.IsNullOrEmpty(text)) 167 { 168 @RenderContent(text, "div", textFontSize, textColor, TextOpacity, textSpacingBottomDesktop, textSpacingBottomMobile, $"mb-0-last-child {textCssClass}") 169 } 170 171 @if (button1Link is object || button2Link is object) 172 { 173 if (contentTextAlignment == "text-start") 174 { 175 contentAlignment = "justify-content-start"; 176 } 177 if (contentTextAlignment == "text-center") 178 { 179 contentAlignment = "justify-content-center"; 180 } 181 if (contentTextAlignment == "text-end") 182 { 183 contentAlignment = "justify-content-end"; 184 } 185 186 <div class="d-flex flex-wrap @(contentAlignment) gap-3"> 187 @if (button1Link is object && !string.IsNullOrEmpty(button1Label)) 188 { 189 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button1Link.IsExternal ? "target=\"_blank\"" : string.Empty; 190 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button1Link.IsExternal ? "rel=\"noopener\"" : string.Empty; 191 192 <a href="@button1Link.Url" @target @rel class="btn @(button1Style)"> 193 @if (button1Icon is object) 194 { 195 <span class="d-flex align-items-center gap-1 @(button1IconPosition)"> 196 @button1Label 197 @if (System.IO.Path.GetExtension(button1Icon).ToLower() == ".svg") 198 { 199 if (!button1Icon.ToLower().Contains("none") && button1Icon != string.Empty) 200 { 201 <span class="icon-auto"> 202 @ReadFile(button1Icon) 203 </span> 204 } 205 } 206 </span> 207 } 208 else 209 { 210 @button1Label 211 } 212 </a> 213 } 214 215 @if (button2Link is object && !string.IsNullOrEmpty(button1Label)) 216 { 217 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button2Link.IsExternal ? "target=\"_blank\"" : string.Empty; 218 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button2Link.IsExternal ? "rel=\"noopener\"" : string.Empty; 219 220 <a href="@button2Link.Url" @target @rel class="btn @(button2Style)"> 221 @if (button2Icon is object) 222 { 223 <span class="d-flex align-items-center gap-1 @(button2IconPosition)"> 224 @button2Label 225 @if (System.IO.Path.GetExtension(button2Icon).ToLower() == ".svg") 226 { 227 if (!button2Icon.ToLower().Contains("none") && button2Icon != string.Empty) 228 { 229 <span class="icon-auto"> 230 @ReadFile(button2Icon) 231 </span> 232 } 233 } 234 </span> 235 } 236 else 237 { 238 @button2Label 239 } 240 </a> 241 } 242 </div> 243 } 244 @if (!string.IsNullOrEmpty(Model.ModuleSystemName)) 245 { 246 <div class="item_@Model.Item.SystemName.ToLower() @textSpacingBottomDesktop @textSpacingBottomMobile mb-0-last-child mt-3"> 247 @Model.GetModuleOutput() 248 </div> 249 } 250 </div> 251 </div> 252
Scott Herskovitz

"Corporate Social Responsibility is a core value that is incorporated into everything we do."
- Scott Herskovitz, President and CEO, Qosina Corp.

EQO-FRIENDLY PRODUCTS

Browse our assortment of products that feature sustainable materials.

OUR CERTIFICATIONS

We are proud to hold a wide variety of business certifications.

COMMUNITY OUTREACH

Read about our commitment to the broader community and our ongoing charitable efforts.

OUR VISION

Corporate Social Responsibility is embedded into our company's mission and vision for the future.

2022 Corporate Social Responsibility Goals

Environment

Benchmark environmental impacts of Qosina office/warehouse and logistics/distribution methods

Reduce carton waste by 10% annually

Plan and map more energy-conscious product delivery routes

Implement CSR bi-weekly team meetings for continual improvement

Localize European inventory (local-for-local)

Ethics

Foster a culture that practices corporate ethics, respects others and observes laws and regulations

Develop and implement a yearly calendar of company philanthropic activities and events

Enroll 90% of corporate employees in required compliance training

Labor & Human Rights

Support the protection of human rights throughout our supply chain

Enroll 90% of employees in human rights training

Survey employees to help develop diverse, equal opportunity programs

Conduct quarterly surveys and listening sessions that allow staff to openly discuss perceptions and ideas

Sustainable Procurement

Engage our current and future supply chain in our CSR efforts

Encourage top and invite new suppliers to participate in our EcoVadis program

Ask suppliers to share documentation on their own CSR business practices

Source products containing sustainable materials

Responsibly promote CSR initiatives through internal and external communications

Our Four Pillars of Corporate Social Responsibility:

Error executing template "Designs/Swift/Paragraph/Swift_TextAdvanced.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_66b0f3e7120d4388b72c8017b5fd214b.RenderCustomCSS(IEnumerable`1 decorations) in G:\Domains\Sites\uat-qmx.mydwsite5.com\Files\Templates\Designs\Swift\Paragraph\Swift_TextAdvanced.cshtml:line 28
   at CompiledRazorTemplates.Dynamic.RazorEngine_66b0f3e7120d4388b72c8017b5fd214b.Execute() in G:\Domains\Sites\uat-qmx.mydwsite5.com\Files\Templates\Designs\Swift\Paragraph\Swift_TextAdvanced.cshtml:line 56
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   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 3 @functions 4 { 5 private string RenderContent(string content, string heading, string fontSize, string color, string opacity, string margin, string marginMobile, string cssClass) 6 { 7 var classes = new List<string> { }; 8 if (!string.IsNullOrEmpty(fontSize)) { classes.Add(fontSize); } 9 if (!string.IsNullOrEmpty(color)) { classes.Add(color); } 10 if (!string.IsNullOrEmpty(opacity)) { classes.Add(opacity); } 11 if (!string.IsNullOrEmpty(margin)) { classes.Add(margin); } 12 if (!string.IsNullOrEmpty(marginMobile)) { classes.Add(marginMobile); } 13 if (!string.IsNullOrEmpty(cssClass)) { classes.Add(cssClass); } 14 15 var tagStart = $"<{heading} class=\"{string.Join(" ", classes)}\">"; 16 var tagEnd = $"</{heading}>"; 17 18 return tagStart + content + tagEnd; 19 } 20 21 string RenderCustomCSS(IEnumerable<string> decorations) 22 { 23 var cssClasses = new List<string>(); 24 25 foreach (var itemId in decorations) 26 { 27 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 28 item.TryGetValue("Class", out object classes); 29 30 if (classes is null) 31 { 32 continue; 33 } 34 35 var cssString = (string)classes; 36 37 if (cssString.StartsWith("[")) 38 { 39 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 40 cssClasses.AddRange(cssArray); 41 } 42 else 43 { 44 cssClasses.Add(cssString.Replace(",", " ")); 45 } 46 } 47 48 return string.Join(" ", cssClasses).Trim(); 49 } 50 } 51 52 @{ 53 54 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? $" theme {Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower()}" : ""; 55 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 56 string css = RenderCustomCSS(decorations); 57 58 string eyebrow = Model.Item.GetString("Eyebrow", string.Empty).Replace(System.Environment.NewLine, "<br>"); 59 string eyebrowHeadingLevel = Model.Item.GetString("EyebrowHeadingLevel", "h3"); 60 string eyebrowFontSize = Model.Item.GetRawValueString("EyebrowFontSize", "h5"); 61 string eyebrowColor = Model.Item.GetString("EyebrowColor", "text-inherit"); 62 string eyebrowTextOpacity = Model.Item.GetString("EyebrowTextOpacity", "opacity-100"); 63 string eyebrowCssClass = Model.Item.GetString("EyebrowCssClass", string.Empty); 64 string eyebrowSpacingBottomDesktop = Model.Item.GetRawValueString("EyebrowSpacingBottomDesktop", "default"); 65 eyebrowSpacingBottomDesktop = eyebrowSpacingBottomDesktop != "default" ? eyebrowSpacingBottomDesktop : string.Empty; 66 string eyebrowSpacingBottomMobile = Model.Item.GetRawValueString("EyebrowSpacingBottomMobile", "default"); 67 eyebrowSpacingBottomMobile = eyebrowSpacingBottomMobile != "default" ? eyebrowSpacingBottomMobile : string.Empty; 68 69 string title = Model.Item.GetString("Title", string.Empty).Replace(System.Environment.NewLine, "<br>"); 70 string titleHeadingLevel = Model.Item.GetString("TitleHeadingLevel", "h2"); 71 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h2"); 72 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 73 string titleTextOpacity = Model.Item.GetString("TitleTextOpacity", "opacity-100"); 74 string titleCssClass = Model.Item.GetString("TitleCssClass", string.Empty); 75 string titleSpacingBottomDesktop = Model.Item.GetRawValueString("TitleSpacingBottomDesktop", "default"); 76 titleSpacingBottomDesktop = titleSpacingBottomDesktop != "default" ? titleSpacingBottomDesktop : string.Empty; 77 string titleSpacingBottomMobile = Model.Item.GetRawValueString("TitleSpacingBottomMobile", "default"); 78 titleSpacingBottomMobile = titleSpacingBottomMobile != "default" ? titleSpacingBottomMobile : string.Empty; 79 80 string subtitle = Model.Item.GetString("Subtitle", string.Empty).Replace(System.Environment.NewLine, "<br>"); 81 string subtitleHeadingLevel = Model.Item.GetString("SubtitleHeadingLevel", "p"); 82 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 83 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 84 string subtitleTextOpacity = Model.Item.GetString("SubtitleTextOpacity", "opacity-100"); 85 string subtitleCssClass = Model.Item.GetString("SubtitleCssClass", string.Empty); 86 string subtitleSpacingBottomDesktop = Model.Item.GetRawValueString("SubtitleSpacingBottomDesktop", "default"); 87 subtitleSpacingBottomDesktop = subtitleSpacingBottomDesktop != "default" ? subtitleSpacingBottomDesktop : string.Empty; 88 string subtitleSpacingBottomMobile = Model.Item.GetRawValueString("SubtitleSpacingBottomMobile", "default"); 89 subtitleSpacingBottomMobile = subtitleSpacingBottomMobile != "default" ? subtitleSpacingBottomMobile : string.Empty; 90 91 string text = Model.Item.GetString("Text", string.Empty); 92 string textFontSize = Model.Item.GetRawValueString("TextFontSize", "fs-6"); 93 string textColor = Model.Item.GetString("TextColor", "text-inherit"); 94 string TextOpacity = Model.Item.GetString("TextOpacity", "opacity-100"); 95 string textCssClass = Model.Item.GetString("TextCssClass", string.Empty); 96 string textSpacingBottomDesktop = Model.Item.GetRawValueString("TextSpacingBottomDesktop", "mb-lg-4"); 97 textSpacingBottomDesktop = textSpacingBottomDesktop != "default" ? textSpacingBottomDesktop : string.Empty; 98 string textSpacingBottomMobile = Model.Item.GetRawValueString("TextSpacingBottomMobile", "mb-3"); 99 textSpacingBottomMobile = textSpacingBottomMobile != "default" ? textSpacingBottomMobile : string.Empty; 100 101 string contentAlignment = Model.Item.GetRawValueString("ContentAlignment", "align-items-center justify-content-center"); 102 string contentTextAlignment = Model.Item.GetRawValueString("ContentTextAlignment", "text-start"); 103 string contentSpacingStartDesktop = Model.Item.GetRawValueString("ContentSpacingStartDesktop", "default"); 104 contentSpacingStartDesktop = contentSpacingStartDesktop != "default" ? contentSpacingStartDesktop : string.Empty; 105 string contentSpacingStartMobile = Model.Item.GetRawValueString("ContentSpacingStartMobile", "default"); 106 contentSpacingStartMobile = contentSpacingStartMobile != "default" ? contentSpacingStartMobile : string.Empty; 107 string contentSpacingEndDesktop = Model.Item.GetRawValueString("ContentSpacingEndDesktop", "default"); 108 contentSpacingEndDesktop = contentSpacingEndDesktop != "default" ? contentSpacingEndDesktop : string.Empty; 109 string contentSpacingEndMobile = Model.Item.GetRawValueString("ContentSpacingEndMobile", "default"); 110 contentSpacingEndMobile = contentSpacingEndMobile != "default" ? contentSpacingEndMobile : string.Empty; 111 string contentSpacingTopDesktop = Model.Item.GetRawValueString("ContentSpacingTopDesktop", "default"); 112 contentSpacingTopDesktop = contentSpacingTopDesktop != "default" ? contentSpacingTopDesktop : string.Empty; 113 string contentSpacingTopMobile = Model.Item.GetRawValueString("ContentSpacingTopMobile", "default"); 114 contentSpacingTopMobile = contentSpacingTopMobile != "default" ? contentSpacingTopMobile : string.Empty; 115 string contentSpacingBottomDesktop = Model.Item.GetRawValueString("ContentSpacingBottomDesktop", "default"); 116 contentSpacingBottomDesktop = contentSpacingBottomDesktop != "default" ? contentSpacingBottomDesktop : string.Empty; 117 string contentSpacingBottomMobile = Model.Item.GetRawValueString("ContentSpacingBottomMobile", "default"); 118 contentSpacingBottomMobile = contentSpacingBottomMobile != "default" ? contentSpacingBottomMobile : string.Empty; 119 string contentCssClass = Model.Item.GetString("ContentCssClass", string.Empty); 120 121 var contentClasses = new List<string> { }; 122 if (contentSpacingStartDesktop != "default") { contentClasses.Add(contentSpacingStartDesktop.Trim()); } 123 if (contentSpacingStartMobile != "default") { contentClasses.Add(contentSpacingStartMobile.Trim()); } 124 if (contentSpacingEndDesktop != "default") { contentClasses.Add(contentSpacingEndDesktop.Trim()); } 125 if (contentSpacingEndMobile != "default") { contentClasses.Add(contentSpacingEndMobile.Trim()); } 126 if (contentSpacingTopDesktop != "default") { contentClasses.Add(contentSpacingTopDesktop.Trim()); } 127 if (contentSpacingTopMobile != "default") { contentClasses.Add(contentSpacingTopMobile.Trim()); } 128 if (contentSpacingBottomDesktop != "default") { contentClasses.Add(contentSpacingBottomDesktop.Trim()); } 129 if (contentSpacingBottomMobile != "default") { contentClasses.Add(contentSpacingBottomMobile.Trim()); } 130 if (!string.IsNullOrEmpty(contentCssClass)) { contentClasses.Add(contentCssClass); } 131 132 //Button 1 133 var button1Link = Model.Item.GetLink("Button1Link"); 134 var button1Label = Model.Item.GetString("Button1Label", string.Empty); 135 var button1Icon = Model.Item.GetRawValueString("Button1Icon"); 136 var button1IconPosition = Model.Item.GetRawValueString("Button1IconPosition", "right"); 137 var button1Style = Model.Item.GetRawValueString("Button1Style", "btn-primary"); 138 139 //Button 2 140 var button2Link = Model.Item.GetLink("Button2Link"); 141 var button2Label = Model.Item.GetString("Button2Label", string.Empty); 142 var button2Icon = Model.Item.GetRawValueString("Button2Icon"); 143 var button2IconPosition = Model.Item.GetRawValueString("Button2IconPosition", "right"); 144 var button2Style = Model.Item.GetRawValueString("Button2Style", "btn-primary"); 145 } 146 147 <div class="h-100 d-flex position-relative @(contentAlignment)@(theme) item_@Model.Item.SystemName.ToLower()"> 148 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top: var(--header-height, 150px)"></div> 149 <div class="d-inline-flex flex-column @(contentTextAlignment) @(string.Join(" ",contentClasses).Trim()) @(css)"> 150 151 @if (!string.IsNullOrEmpty(eyebrow)) 152 { 153 @RenderContent(eyebrow, eyebrowHeadingLevel, eyebrowFontSize, eyebrowColor, eyebrowTextOpacity, eyebrowSpacingBottomDesktop, eyebrowSpacingBottomMobile, eyebrowCssClass) 154 } 155 156 @if (!string.IsNullOrEmpty(title)) 157 { 158 @RenderContent(title, titleHeadingLevel, titleFontSize, titleColor, titleTextOpacity, titleSpacingBottomDesktop, titleSpacingBottomMobile, titleCssClass) 159 } 160 161 @if (!string.IsNullOrEmpty(subtitle)) 162 { 163 @RenderContent(subtitle, subtitleHeadingLevel, subtitleFontSize, subtitleColor, subtitleTextOpacity, subtitleSpacingBottomDesktop, subtitleSpacingBottomMobile, subtitleCssClass) 164 } 165 166 @if (!string.IsNullOrEmpty(text)) 167 { 168 @RenderContent(text, "div", textFontSize, textColor, TextOpacity, textSpacingBottomDesktop, textSpacingBottomMobile, $"mb-0-last-child {textCssClass}") 169 } 170 171 @if (button1Link is object || button2Link is object) 172 { 173 if (contentTextAlignment == "text-start") 174 { 175 contentAlignment = "justify-content-start"; 176 } 177 if (contentTextAlignment == "text-center") 178 { 179 contentAlignment = "justify-content-center"; 180 } 181 if (contentTextAlignment == "text-end") 182 { 183 contentAlignment = "justify-content-end"; 184 } 185 186 <div class="d-flex flex-wrap @(contentAlignment) gap-3"> 187 @if (button1Link is object && !string.IsNullOrEmpty(button1Label)) 188 { 189 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button1Link.IsExternal ? "target=\"_blank\"" : string.Empty; 190 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button1Link.IsExternal ? "rel=\"noopener\"" : string.Empty; 191 192 <a href="@button1Link.Url" @target @rel class="btn @(button1Style)"> 193 @if (button1Icon is object) 194 { 195 <span class="d-flex align-items-center gap-1 @(button1IconPosition)"> 196 @button1Label 197 @if (System.IO.Path.GetExtension(button1Icon).ToLower() == ".svg") 198 { 199 if (!button1Icon.ToLower().Contains("none") && button1Icon != string.Empty) 200 { 201 <span class="icon-auto"> 202 @ReadFile(button1Icon) 203 </span> 204 } 205 } 206 </span> 207 } 208 else 209 { 210 @button1Label 211 } 212 </a> 213 } 214 215 @if (button2Link is object && !string.IsNullOrEmpty(button1Label)) 216 { 217 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button2Link.IsExternal ? "target=\"_blank\"" : string.Empty; 218 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button2Link.IsExternal ? "rel=\"noopener\"" : string.Empty; 219 220 <a href="@button2Link.Url" @target @rel class="btn @(button2Style)"> 221 @if (button2Icon is object) 222 { 223 <span class="d-flex align-items-center gap-1 @(button2IconPosition)"> 224 @button2Label 225 @if (System.IO.Path.GetExtension(button2Icon).ToLower() == ".svg") 226 { 227 if (!button2Icon.ToLower().Contains("none") && button2Icon != string.Empty) 228 { 229 <span class="icon-auto"> 230 @ReadFile(button2Icon) 231 </span> 232 } 233 } 234 </span> 235 } 236 else 237 { 238 @button2Label 239 } 240 </a> 241 } 242 </div> 243 } 244 @if (!string.IsNullOrEmpty(Model.ModuleSystemName)) 245 { 246 <div class="item_@Model.Item.SystemName.ToLower() @textSpacingBottomDesktop @textSpacingBottomMobile mb-0-last-child mt-3"> 247 @Model.GetModuleOutput() 248 </div> 249 } 250 </div> 251 </div> 252
Error executing template "Designs/Swift/Paragraph/Swift_TextAdvanced.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_66b0f3e7120d4388b72c8017b5fd214b.RenderCustomCSS(IEnumerable`1 decorations) in G:\Domains\Sites\uat-qmx.mydwsite5.com\Files\Templates\Designs\Swift\Paragraph\Swift_TextAdvanced.cshtml:line 28
   at CompiledRazorTemplates.Dynamic.RazorEngine_66b0f3e7120d4388b72c8017b5fd214b.Execute() in G:\Domains\Sites\uat-qmx.mydwsite5.com\Files\Templates\Designs\Swift\Paragraph\Swift_TextAdvanced.cshtml:line 56
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   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 3 @functions 4 { 5 private string RenderContent(string content, string heading, string fontSize, string color, string opacity, string margin, string marginMobile, string cssClass) 6 { 7 var classes = new List<string> { }; 8 if (!string.IsNullOrEmpty(fontSize)) { classes.Add(fontSize); } 9 if (!string.IsNullOrEmpty(color)) { classes.Add(color); } 10 if (!string.IsNullOrEmpty(opacity)) { classes.Add(opacity); } 11 if (!string.IsNullOrEmpty(margin)) { classes.Add(margin); } 12 if (!string.IsNullOrEmpty(marginMobile)) { classes.Add(marginMobile); } 13 if (!string.IsNullOrEmpty(cssClass)) { classes.Add(cssClass); } 14 15 var tagStart = $"<{heading} class=\"{string.Join(" ", classes)}\">"; 16 var tagEnd = $"</{heading}>"; 17 18 return tagStart + content + tagEnd; 19 } 20 21 string RenderCustomCSS(IEnumerable<string> decorations) 22 { 23 var cssClasses = new List<string>(); 24 25 foreach (var itemId in decorations) 26 { 27 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 28 item.TryGetValue("Class", out object classes); 29 30 if (classes is null) 31 { 32 continue; 33 } 34 35 var cssString = (string)classes; 36 37 if (cssString.StartsWith("[")) 38 { 39 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 40 cssClasses.AddRange(cssArray); 41 } 42 else 43 { 44 cssClasses.Add(cssString.Replace(",", " ")); 45 } 46 } 47 48 return string.Join(" ", cssClasses).Trim(); 49 } 50 } 51 52 @{ 53 54 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? $" theme {Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower()}" : ""; 55 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 56 string css = RenderCustomCSS(decorations); 57 58 string eyebrow = Model.Item.GetString("Eyebrow", string.Empty).Replace(System.Environment.NewLine, "<br>"); 59 string eyebrowHeadingLevel = Model.Item.GetString("EyebrowHeadingLevel", "h3"); 60 string eyebrowFontSize = Model.Item.GetRawValueString("EyebrowFontSize", "h5"); 61 string eyebrowColor = Model.Item.GetString("EyebrowColor", "text-inherit"); 62 string eyebrowTextOpacity = Model.Item.GetString("EyebrowTextOpacity", "opacity-100"); 63 string eyebrowCssClass = Model.Item.GetString("EyebrowCssClass", string.Empty); 64 string eyebrowSpacingBottomDesktop = Model.Item.GetRawValueString("EyebrowSpacingBottomDesktop", "default"); 65 eyebrowSpacingBottomDesktop = eyebrowSpacingBottomDesktop != "default" ? eyebrowSpacingBottomDesktop : string.Empty; 66 string eyebrowSpacingBottomMobile = Model.Item.GetRawValueString("EyebrowSpacingBottomMobile", "default"); 67 eyebrowSpacingBottomMobile = eyebrowSpacingBottomMobile != "default" ? eyebrowSpacingBottomMobile : string.Empty; 68 69 string title = Model.Item.GetString("Title", string.Empty).Replace(System.Environment.NewLine, "<br>"); 70 string titleHeadingLevel = Model.Item.GetString("TitleHeadingLevel", "h2"); 71 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h2"); 72 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 73 string titleTextOpacity = Model.Item.GetString("TitleTextOpacity", "opacity-100"); 74 string titleCssClass = Model.Item.GetString("TitleCssClass", string.Empty); 75 string titleSpacingBottomDesktop = Model.Item.GetRawValueString("TitleSpacingBottomDesktop", "default"); 76 titleSpacingBottomDesktop = titleSpacingBottomDesktop != "default" ? titleSpacingBottomDesktop : string.Empty; 77 string titleSpacingBottomMobile = Model.Item.GetRawValueString("TitleSpacingBottomMobile", "default"); 78 titleSpacingBottomMobile = titleSpacingBottomMobile != "default" ? titleSpacingBottomMobile : string.Empty; 79 80 string subtitle = Model.Item.GetString("Subtitle", string.Empty).Replace(System.Environment.NewLine, "<br>"); 81 string subtitleHeadingLevel = Model.Item.GetString("SubtitleHeadingLevel", "p"); 82 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 83 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 84 string subtitleTextOpacity = Model.Item.GetString("SubtitleTextOpacity", "opacity-100"); 85 string subtitleCssClass = Model.Item.GetString("SubtitleCssClass", string.Empty); 86 string subtitleSpacingBottomDesktop = Model.Item.GetRawValueString("SubtitleSpacingBottomDesktop", "default"); 87 subtitleSpacingBottomDesktop = subtitleSpacingBottomDesktop != "default" ? subtitleSpacingBottomDesktop : string.Empty; 88 string subtitleSpacingBottomMobile = Model.Item.GetRawValueString("SubtitleSpacingBottomMobile", "default"); 89 subtitleSpacingBottomMobile = subtitleSpacingBottomMobile != "default" ? subtitleSpacingBottomMobile : string.Empty; 90 91 string text = Model.Item.GetString("Text", string.Empty); 92 string textFontSize = Model.Item.GetRawValueString("TextFontSize", "fs-6"); 93 string textColor = Model.Item.GetString("TextColor", "text-inherit"); 94 string TextOpacity = Model.Item.GetString("TextOpacity", "opacity-100"); 95 string textCssClass = Model.Item.GetString("TextCssClass", string.Empty); 96 string textSpacingBottomDesktop = Model.Item.GetRawValueString("TextSpacingBottomDesktop", "mb-lg-4"); 97 textSpacingBottomDesktop = textSpacingBottomDesktop != "default" ? textSpacingBottomDesktop : string.Empty; 98 string textSpacingBottomMobile = Model.Item.GetRawValueString("TextSpacingBottomMobile", "mb-3"); 99 textSpacingBottomMobile = textSpacingBottomMobile != "default" ? textSpacingBottomMobile : string.Empty; 100 101 string contentAlignment = Model.Item.GetRawValueString("ContentAlignment", "align-items-center justify-content-center"); 102 string contentTextAlignment = Model.Item.GetRawValueString("ContentTextAlignment", "text-start"); 103 string contentSpacingStartDesktop = Model.Item.GetRawValueString("ContentSpacingStartDesktop", "default"); 104 contentSpacingStartDesktop = contentSpacingStartDesktop != "default" ? contentSpacingStartDesktop : string.Empty; 105 string contentSpacingStartMobile = Model.Item.GetRawValueString("ContentSpacingStartMobile", "default"); 106 contentSpacingStartMobile = contentSpacingStartMobile != "default" ? contentSpacingStartMobile : string.Empty; 107 string contentSpacingEndDesktop = Model.Item.GetRawValueString("ContentSpacingEndDesktop", "default"); 108 contentSpacingEndDesktop = contentSpacingEndDesktop != "default" ? contentSpacingEndDesktop : string.Empty; 109 string contentSpacingEndMobile = Model.Item.GetRawValueString("ContentSpacingEndMobile", "default"); 110 contentSpacingEndMobile = contentSpacingEndMobile != "default" ? contentSpacingEndMobile : string.Empty; 111 string contentSpacingTopDesktop = Model.Item.GetRawValueString("ContentSpacingTopDesktop", "default"); 112 contentSpacingTopDesktop = contentSpacingTopDesktop != "default" ? contentSpacingTopDesktop : string.Empty; 113 string contentSpacingTopMobile = Model.Item.GetRawValueString("ContentSpacingTopMobile", "default"); 114 contentSpacingTopMobile = contentSpacingTopMobile != "default" ? contentSpacingTopMobile : string.Empty; 115 string contentSpacingBottomDesktop = Model.Item.GetRawValueString("ContentSpacingBottomDesktop", "default"); 116 contentSpacingBottomDesktop = contentSpacingBottomDesktop != "default" ? contentSpacingBottomDesktop : string.Empty; 117 string contentSpacingBottomMobile = Model.Item.GetRawValueString("ContentSpacingBottomMobile", "default"); 118 contentSpacingBottomMobile = contentSpacingBottomMobile != "default" ? contentSpacingBottomMobile : string.Empty; 119 string contentCssClass = Model.Item.GetString("ContentCssClass", string.Empty); 120 121 var contentClasses = new List<string> { }; 122 if (contentSpacingStartDesktop != "default") { contentClasses.Add(contentSpacingStartDesktop.Trim()); } 123 if (contentSpacingStartMobile != "default") { contentClasses.Add(contentSpacingStartMobile.Trim()); } 124 if (contentSpacingEndDesktop != "default") { contentClasses.Add(contentSpacingEndDesktop.Trim()); } 125 if (contentSpacingEndMobile != "default") { contentClasses.Add(contentSpacingEndMobile.Trim()); } 126 if (contentSpacingTopDesktop != "default") { contentClasses.Add(contentSpacingTopDesktop.Trim()); } 127 if (contentSpacingTopMobile != "default") { contentClasses.Add(contentSpacingTopMobile.Trim()); } 128 if (contentSpacingBottomDesktop != "default") { contentClasses.Add(contentSpacingBottomDesktop.Trim()); } 129 if (contentSpacingBottomMobile != "default") { contentClasses.Add(contentSpacingBottomMobile.Trim()); } 130 if (!string.IsNullOrEmpty(contentCssClass)) { contentClasses.Add(contentCssClass); } 131 132 //Button 1 133 var button1Link = Model.Item.GetLink("Button1Link"); 134 var button1Label = Model.Item.GetString("Button1Label", string.Empty); 135 var button1Icon = Model.Item.GetRawValueString("Button1Icon"); 136 var button1IconPosition = Model.Item.GetRawValueString("Button1IconPosition", "right"); 137 var button1Style = Model.Item.GetRawValueString("Button1Style", "btn-primary"); 138 139 //Button 2 140 var button2Link = Model.Item.GetLink("Button2Link"); 141 var button2Label = Model.Item.GetString("Button2Label", string.Empty); 142 var button2Icon = Model.Item.GetRawValueString("Button2Icon"); 143 var button2IconPosition = Model.Item.GetRawValueString("Button2IconPosition", "right"); 144 var button2Style = Model.Item.GetRawValueString("Button2Style", "btn-primary"); 145 } 146 147 <div class="h-100 d-flex position-relative @(contentAlignment)@(theme) item_@Model.Item.SystemName.ToLower()"> 148 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top: var(--header-height, 150px)"></div> 149 <div class="d-inline-flex flex-column @(contentTextAlignment) @(string.Join(" ",contentClasses).Trim()) @(css)"> 150 151 @if (!string.IsNullOrEmpty(eyebrow)) 152 { 153 @RenderContent(eyebrow, eyebrowHeadingLevel, eyebrowFontSize, eyebrowColor, eyebrowTextOpacity, eyebrowSpacingBottomDesktop, eyebrowSpacingBottomMobile, eyebrowCssClass) 154 } 155 156 @if (!string.IsNullOrEmpty(title)) 157 { 158 @RenderContent(title, titleHeadingLevel, titleFontSize, titleColor, titleTextOpacity, titleSpacingBottomDesktop, titleSpacingBottomMobile, titleCssClass) 159 } 160 161 @if (!string.IsNullOrEmpty(subtitle)) 162 { 163 @RenderContent(subtitle, subtitleHeadingLevel, subtitleFontSize, subtitleColor, subtitleTextOpacity, subtitleSpacingBottomDesktop, subtitleSpacingBottomMobile, subtitleCssClass) 164 } 165 166 @if (!string.IsNullOrEmpty(text)) 167 { 168 @RenderContent(text, "div", textFontSize, textColor, TextOpacity, textSpacingBottomDesktop, textSpacingBottomMobile, $"mb-0-last-child {textCssClass}") 169 } 170 171 @if (button1Link is object || button2Link is object) 172 { 173 if (contentTextAlignment == "text-start") 174 { 175 contentAlignment = "justify-content-start"; 176 } 177 if (contentTextAlignment == "text-center") 178 { 179 contentAlignment = "justify-content-center"; 180 } 181 if (contentTextAlignment == "text-end") 182 { 183 contentAlignment = "justify-content-end"; 184 } 185 186 <div class="d-flex flex-wrap @(contentAlignment) gap-3"> 187 @if (button1Link is object && !string.IsNullOrEmpty(button1Label)) 188 { 189 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button1Link.IsExternal ? "target=\"_blank\"" : string.Empty; 190 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button1Link.IsExternal ? "rel=\"noopener\"" : string.Empty; 191 192 <a href="@button1Link.Url" @target @rel class="btn @(button1Style)"> 193 @if (button1Icon is object) 194 { 195 <span class="d-flex align-items-center gap-1 @(button1IconPosition)"> 196 @button1Label 197 @if (System.IO.Path.GetExtension(button1Icon).ToLower() == ".svg") 198 { 199 if (!button1Icon.ToLower().Contains("none") && button1Icon != string.Empty) 200 { 201 <span class="icon-auto"> 202 @ReadFile(button1Icon) 203 </span> 204 } 205 } 206 </span> 207 } 208 else 209 { 210 @button1Label 211 } 212 </a> 213 } 214 215 @if (button2Link is object && !string.IsNullOrEmpty(button1Label)) 216 { 217 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button2Link.IsExternal ? "target=\"_blank\"" : string.Empty; 218 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button2Link.IsExternal ? "rel=\"noopener\"" : string.Empty; 219 220 <a href="@button2Link.Url" @target @rel class="btn @(button2Style)"> 221 @if (button2Icon is object) 222 { 223 <span class="d-flex align-items-center gap-1 @(button2IconPosition)"> 224 @button2Label 225 @if (System.IO.Path.GetExtension(button2Icon).ToLower() == ".svg") 226 { 227 if (!button2Icon.ToLower().Contains("none") && button2Icon != string.Empty) 228 { 229 <span class="icon-auto"> 230 @ReadFile(button2Icon) 231 </span> 232 } 233 } 234 </span> 235 } 236 else 237 { 238 @button2Label 239 } 240 </a> 241 } 242 </div> 243 } 244 @if (!string.IsNullOrEmpty(Model.ModuleSystemName)) 245 { 246 <div class="item_@Model.Item.SystemName.ToLower() @textSpacingBottomDesktop @textSpacingBottomMobile mb-0-last-child mt-3"> 247 @Model.GetModuleOutput() 248 </div> 249 } 250 </div> 251 </div> 252
Error executing template "Designs/Swift/Paragraph/Swift_TextAdvanced.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_66b0f3e7120d4388b72c8017b5fd214b.RenderCustomCSS(IEnumerable`1 decorations) in G:\Domains\Sites\uat-qmx.mydwsite5.com\Files\Templates\Designs\Swift\Paragraph\Swift_TextAdvanced.cshtml:line 28
   at CompiledRazorTemplates.Dynamic.RazorEngine_66b0f3e7120d4388b72c8017b5fd214b.Execute() in G:\Domains\Sites\uat-qmx.mydwsite5.com\Files\Templates\Designs\Swift\Paragraph\Swift_TextAdvanced.cshtml:line 56
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   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 3 @functions 4 { 5 private string RenderContent(string content, string heading, string fontSize, string color, string opacity, string margin, string marginMobile, string cssClass) 6 { 7 var classes = new List<string> { }; 8 if (!string.IsNullOrEmpty(fontSize)) { classes.Add(fontSize); } 9 if (!string.IsNullOrEmpty(color)) { classes.Add(color); } 10 if (!string.IsNullOrEmpty(opacity)) { classes.Add(opacity); } 11 if (!string.IsNullOrEmpty(margin)) { classes.Add(margin); } 12 if (!string.IsNullOrEmpty(marginMobile)) { classes.Add(marginMobile); } 13 if (!string.IsNullOrEmpty(cssClass)) { classes.Add(cssClass); } 14 15 var tagStart = $"<{heading} class=\"{string.Join(" ", classes)}\">"; 16 var tagEnd = $"</{heading}>"; 17 18 return tagStart + content + tagEnd; 19 } 20 21 string RenderCustomCSS(IEnumerable<string> decorations) 22 { 23 var cssClasses = new List<string>(); 24 25 foreach (var itemId in decorations) 26 { 27 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 28 item.TryGetValue("Class", out object classes); 29 30 if (classes is null) 31 { 32 continue; 33 } 34 35 var cssString = (string)classes; 36 37 if (cssString.StartsWith("[")) 38 { 39 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 40 cssClasses.AddRange(cssArray); 41 } 42 else 43 { 44 cssClasses.Add(cssString.Replace(",", " ")); 45 } 46 } 47 48 return string.Join(" ", cssClasses).Trim(); 49 } 50 } 51 52 @{ 53 54 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? $" theme {Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower()}" : ""; 55 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 56 string css = RenderCustomCSS(decorations); 57 58 string eyebrow = Model.Item.GetString("Eyebrow", string.Empty).Replace(System.Environment.NewLine, "<br>"); 59 string eyebrowHeadingLevel = Model.Item.GetString("EyebrowHeadingLevel", "h3"); 60 string eyebrowFontSize = Model.Item.GetRawValueString("EyebrowFontSize", "h5"); 61 string eyebrowColor = Model.Item.GetString("EyebrowColor", "text-inherit"); 62 string eyebrowTextOpacity = Model.Item.GetString("EyebrowTextOpacity", "opacity-100"); 63 string eyebrowCssClass = Model.Item.GetString("EyebrowCssClass", string.Empty); 64 string eyebrowSpacingBottomDesktop = Model.Item.GetRawValueString("EyebrowSpacingBottomDesktop", "default"); 65 eyebrowSpacingBottomDesktop = eyebrowSpacingBottomDesktop != "default" ? eyebrowSpacingBottomDesktop : string.Empty; 66 string eyebrowSpacingBottomMobile = Model.Item.GetRawValueString("EyebrowSpacingBottomMobile", "default"); 67 eyebrowSpacingBottomMobile = eyebrowSpacingBottomMobile != "default" ? eyebrowSpacingBottomMobile : string.Empty; 68 69 string title = Model.Item.GetString("Title", string.Empty).Replace(System.Environment.NewLine, "<br>"); 70 string titleHeadingLevel = Model.Item.GetString("TitleHeadingLevel", "h2"); 71 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h2"); 72 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 73 string titleTextOpacity = Model.Item.GetString("TitleTextOpacity", "opacity-100"); 74 string titleCssClass = Model.Item.GetString("TitleCssClass", string.Empty); 75 string titleSpacingBottomDesktop = Model.Item.GetRawValueString("TitleSpacingBottomDesktop", "default"); 76 titleSpacingBottomDesktop = titleSpacingBottomDesktop != "default" ? titleSpacingBottomDesktop : string.Empty; 77 string titleSpacingBottomMobile = Model.Item.GetRawValueString("TitleSpacingBottomMobile", "default"); 78 titleSpacingBottomMobile = titleSpacingBottomMobile != "default" ? titleSpacingBottomMobile : string.Empty; 79 80 string subtitle = Model.Item.GetString("Subtitle", string.Empty).Replace(System.Environment.NewLine, "<br>"); 81 string subtitleHeadingLevel = Model.Item.GetString("SubtitleHeadingLevel", "p"); 82 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 83 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 84 string subtitleTextOpacity = Model.Item.GetString("SubtitleTextOpacity", "opacity-100"); 85 string subtitleCssClass = Model.Item.GetString("SubtitleCssClass", string.Empty); 86 string subtitleSpacingBottomDesktop = Model.Item.GetRawValueString("SubtitleSpacingBottomDesktop", "default"); 87 subtitleSpacingBottomDesktop = subtitleSpacingBottomDesktop != "default" ? subtitleSpacingBottomDesktop : string.Empty; 88 string subtitleSpacingBottomMobile = Model.Item.GetRawValueString("SubtitleSpacingBottomMobile", "default"); 89 subtitleSpacingBottomMobile = subtitleSpacingBottomMobile != "default" ? subtitleSpacingBottomMobile : string.Empty; 90 91 string text = Model.Item.GetString("Text", string.Empty); 92 string textFontSize = Model.Item.GetRawValueString("TextFontSize", "fs-6"); 93 string textColor = Model.Item.GetString("TextColor", "text-inherit"); 94 string TextOpacity = Model.Item.GetString("TextOpacity", "opacity-100"); 95 string textCssClass = Model.Item.GetString("TextCssClass", string.Empty); 96 string textSpacingBottomDesktop = Model.Item.GetRawValueString("TextSpacingBottomDesktop", "mb-lg-4"); 97 textSpacingBottomDesktop = textSpacingBottomDesktop != "default" ? textSpacingBottomDesktop : string.Empty; 98 string textSpacingBottomMobile = Model.Item.GetRawValueString("TextSpacingBottomMobile", "mb-3"); 99 textSpacingBottomMobile = textSpacingBottomMobile != "default" ? textSpacingBottomMobile : string.Empty; 100 101 string contentAlignment = Model.Item.GetRawValueString("ContentAlignment", "align-items-center justify-content-center"); 102 string contentTextAlignment = Model.Item.GetRawValueString("ContentTextAlignment", "text-start"); 103 string contentSpacingStartDesktop = Model.Item.GetRawValueString("ContentSpacingStartDesktop", "default"); 104 contentSpacingStartDesktop = contentSpacingStartDesktop != "default" ? contentSpacingStartDesktop : string.Empty; 105 string contentSpacingStartMobile = Model.Item.GetRawValueString("ContentSpacingStartMobile", "default"); 106 contentSpacingStartMobile = contentSpacingStartMobile != "default" ? contentSpacingStartMobile : string.Empty; 107 string contentSpacingEndDesktop = Model.Item.GetRawValueString("ContentSpacingEndDesktop", "default"); 108 contentSpacingEndDesktop = contentSpacingEndDesktop != "default" ? contentSpacingEndDesktop : string.Empty; 109 string contentSpacingEndMobile = Model.Item.GetRawValueString("ContentSpacingEndMobile", "default"); 110 contentSpacingEndMobile = contentSpacingEndMobile != "default" ? contentSpacingEndMobile : string.Empty; 111 string contentSpacingTopDesktop = Model.Item.GetRawValueString("ContentSpacingTopDesktop", "default"); 112 contentSpacingTopDesktop = contentSpacingTopDesktop != "default" ? contentSpacingTopDesktop : string.Empty; 113 string contentSpacingTopMobile = Model.Item.GetRawValueString("ContentSpacingTopMobile", "default"); 114 contentSpacingTopMobile = contentSpacingTopMobile != "default" ? contentSpacingTopMobile : string.Empty; 115 string contentSpacingBottomDesktop = Model.Item.GetRawValueString("ContentSpacingBottomDesktop", "default"); 116 contentSpacingBottomDesktop = contentSpacingBottomDesktop != "default" ? contentSpacingBottomDesktop : string.Empty; 117 string contentSpacingBottomMobile = Model.Item.GetRawValueString("ContentSpacingBottomMobile", "default"); 118 contentSpacingBottomMobile = contentSpacingBottomMobile != "default" ? contentSpacingBottomMobile : string.Empty; 119 string contentCssClass = Model.Item.GetString("ContentCssClass", string.Empty); 120 121 var contentClasses = new List<string> { }; 122 if (contentSpacingStartDesktop != "default") { contentClasses.Add(contentSpacingStartDesktop.Trim()); } 123 if (contentSpacingStartMobile != "default") { contentClasses.Add(contentSpacingStartMobile.Trim()); } 124 if (contentSpacingEndDesktop != "default") { contentClasses.Add(contentSpacingEndDesktop.Trim()); } 125 if (contentSpacingEndMobile != "default") { contentClasses.Add(contentSpacingEndMobile.Trim()); } 126 if (contentSpacingTopDesktop != "default") { contentClasses.Add(contentSpacingTopDesktop.Trim()); } 127 if (contentSpacingTopMobile != "default") { contentClasses.Add(contentSpacingTopMobile.Trim()); } 128 if (contentSpacingBottomDesktop != "default") { contentClasses.Add(contentSpacingBottomDesktop.Trim()); } 129 if (contentSpacingBottomMobile != "default") { contentClasses.Add(contentSpacingBottomMobile.Trim()); } 130 if (!string.IsNullOrEmpty(contentCssClass)) { contentClasses.Add(contentCssClass); } 131 132 //Button 1 133 var button1Link = Model.Item.GetLink("Button1Link"); 134 var button1Label = Model.Item.GetString("Button1Label", string.Empty); 135 var button1Icon = Model.Item.GetRawValueString("Button1Icon"); 136 var button1IconPosition = Model.Item.GetRawValueString("Button1IconPosition", "right"); 137 var button1Style = Model.Item.GetRawValueString("Button1Style", "btn-primary"); 138 139 //Button 2 140 var button2Link = Model.Item.GetLink("Button2Link"); 141 var button2Label = Model.Item.GetString("Button2Label", string.Empty); 142 var button2Icon = Model.Item.GetRawValueString("Button2Icon"); 143 var button2IconPosition = Model.Item.GetRawValueString("Button2IconPosition", "right"); 144 var button2Style = Model.Item.GetRawValueString("Button2Style", "btn-primary"); 145 } 146 147 <div class="h-100 d-flex position-relative @(contentAlignment)@(theme) item_@Model.Item.SystemName.ToLower()"> 148 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top: var(--header-height, 150px)"></div> 149 <div class="d-inline-flex flex-column @(contentTextAlignment) @(string.Join(" ",contentClasses).Trim()) @(css)"> 150 151 @if (!string.IsNullOrEmpty(eyebrow)) 152 { 153 @RenderContent(eyebrow, eyebrowHeadingLevel, eyebrowFontSize, eyebrowColor, eyebrowTextOpacity, eyebrowSpacingBottomDesktop, eyebrowSpacingBottomMobile, eyebrowCssClass) 154 } 155 156 @if (!string.IsNullOrEmpty(title)) 157 { 158 @RenderContent(title, titleHeadingLevel, titleFontSize, titleColor, titleTextOpacity, titleSpacingBottomDesktop, titleSpacingBottomMobile, titleCssClass) 159 } 160 161 @if (!string.IsNullOrEmpty(subtitle)) 162 { 163 @RenderContent(subtitle, subtitleHeadingLevel, subtitleFontSize, subtitleColor, subtitleTextOpacity, subtitleSpacingBottomDesktop, subtitleSpacingBottomMobile, subtitleCssClass) 164 } 165 166 @if (!string.IsNullOrEmpty(text)) 167 { 168 @RenderContent(text, "div", textFontSize, textColor, TextOpacity, textSpacingBottomDesktop, textSpacingBottomMobile, $"mb-0-last-child {textCssClass}") 169 } 170 171 @if (button1Link is object || button2Link is object) 172 { 173 if (contentTextAlignment == "text-start") 174 { 175 contentAlignment = "justify-content-start"; 176 } 177 if (contentTextAlignment == "text-center") 178 { 179 contentAlignment = "justify-content-center"; 180 } 181 if (contentTextAlignment == "text-end") 182 { 183 contentAlignment = "justify-content-end"; 184 } 185 186 <div class="d-flex flex-wrap @(contentAlignment) gap-3"> 187 @if (button1Link is object && !string.IsNullOrEmpty(button1Label)) 188 { 189 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button1Link.IsExternal ? "target=\"_blank\"" : string.Empty; 190 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button1Link.IsExternal ? "rel=\"noopener\"" : string.Empty; 191 192 <a href="@button1Link.Url" @target @rel class="btn @(button1Style)"> 193 @if (button1Icon is object) 194 { 195 <span class="d-flex align-items-center gap-1 @(button1IconPosition)"> 196 @button1Label 197 @if (System.IO.Path.GetExtension(button1Icon).ToLower() == ".svg") 198 { 199 if (!button1Icon.ToLower().Contains("none") && button1Icon != string.Empty) 200 { 201 <span class="icon-auto"> 202 @ReadFile(button1Icon) 203 </span> 204 } 205 } 206 </span> 207 } 208 else 209 { 210 @button1Label 211 } 212 </a> 213 } 214 215 @if (button2Link is object && !string.IsNullOrEmpty(button1Label)) 216 { 217 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button2Link.IsExternal ? "target=\"_blank\"" : string.Empty; 218 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button2Link.IsExternal ? "rel=\"noopener\"" : string.Empty; 219 220 <a href="@button2Link.Url" @target @rel class="btn @(button2Style)"> 221 @if (button2Icon is object) 222 { 223 <span class="d-flex align-items-center gap-1 @(button2IconPosition)"> 224 @button2Label 225 @if (System.IO.Path.GetExtension(button2Icon).ToLower() == ".svg") 226 { 227 if (!button2Icon.ToLower().Contains("none") && button2Icon != string.Empty) 228 { 229 <span class="icon-auto"> 230 @ReadFile(button2Icon) 231 </span> 232 } 233 } 234 </span> 235 } 236 else 237 { 238 @button2Label 239 } 240 </a> 241 } 242 </div> 243 } 244 @if (!string.IsNullOrEmpty(Model.ModuleSystemName)) 245 { 246 <div class="item_@Model.Item.SystemName.ToLower() @textSpacingBottomDesktop @textSpacingBottomMobile mb-0-last-child mt-3"> 247 @Model.GetModuleOutput() 248 </div> 249 } 250 </div> 251 </div> 252
Error executing template "Designs/Swift/Paragraph/Swift_TextAdvanced.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_66b0f3e7120d4388b72c8017b5fd214b.RenderCustomCSS(IEnumerable`1 decorations) in G:\Domains\Sites\uat-qmx.mydwsite5.com\Files\Templates\Designs\Swift\Paragraph\Swift_TextAdvanced.cshtml:line 28
   at CompiledRazorTemplates.Dynamic.RazorEngine_66b0f3e7120d4388b72c8017b5fd214b.Execute() in G:\Domains\Sites\uat-qmx.mydwsite5.com\Files\Templates\Designs\Swift\Paragraph\Swift_TextAdvanced.cshtml:line 56
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   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 3 @functions 4 { 5 private string RenderContent(string content, string heading, string fontSize, string color, string opacity, string margin, string marginMobile, string cssClass) 6 { 7 var classes = new List<string> { }; 8 if (!string.IsNullOrEmpty(fontSize)) { classes.Add(fontSize); } 9 if (!string.IsNullOrEmpty(color)) { classes.Add(color); } 10 if (!string.IsNullOrEmpty(opacity)) { classes.Add(opacity); } 11 if (!string.IsNullOrEmpty(margin)) { classes.Add(margin); } 12 if (!string.IsNullOrEmpty(marginMobile)) { classes.Add(marginMobile); } 13 if (!string.IsNullOrEmpty(cssClass)) { classes.Add(cssClass); } 14 15 var tagStart = $"<{heading} class=\"{string.Join(" ", classes)}\">"; 16 var tagEnd = $"</{heading}>"; 17 18 return tagStart + content + tagEnd; 19 } 20 21 string RenderCustomCSS(IEnumerable<string> decorations) 22 { 23 var cssClasses = new List<string>(); 24 25 foreach (var itemId in decorations) 26 { 27 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 28 item.TryGetValue("Class", out object classes); 29 30 if (classes is null) 31 { 32 continue; 33 } 34 35 var cssString = (string)classes; 36 37 if (cssString.StartsWith("[")) 38 { 39 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 40 cssClasses.AddRange(cssArray); 41 } 42 else 43 { 44 cssClasses.Add(cssString.Replace(",", " ")); 45 } 46 } 47 48 return string.Join(" ", cssClasses).Trim(); 49 } 50 } 51 52 @{ 53 54 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? $" theme {Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower()}" : ""; 55 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 56 string css = RenderCustomCSS(decorations); 57 58 string eyebrow = Model.Item.GetString("Eyebrow", string.Empty).Replace(System.Environment.NewLine, "<br>"); 59 string eyebrowHeadingLevel = Model.Item.GetString("EyebrowHeadingLevel", "h3"); 60 string eyebrowFontSize = Model.Item.GetRawValueString("EyebrowFontSize", "h5"); 61 string eyebrowColor = Model.Item.GetString("EyebrowColor", "text-inherit"); 62 string eyebrowTextOpacity = Model.Item.GetString("EyebrowTextOpacity", "opacity-100"); 63 string eyebrowCssClass = Model.Item.GetString("EyebrowCssClass", string.Empty); 64 string eyebrowSpacingBottomDesktop = Model.Item.GetRawValueString("EyebrowSpacingBottomDesktop", "default"); 65 eyebrowSpacingBottomDesktop = eyebrowSpacingBottomDesktop != "default" ? eyebrowSpacingBottomDesktop : string.Empty; 66 string eyebrowSpacingBottomMobile = Model.Item.GetRawValueString("EyebrowSpacingBottomMobile", "default"); 67 eyebrowSpacingBottomMobile = eyebrowSpacingBottomMobile != "default" ? eyebrowSpacingBottomMobile : string.Empty; 68 69 string title = Model.Item.GetString("Title", string.Empty).Replace(System.Environment.NewLine, "<br>"); 70 string titleHeadingLevel = Model.Item.GetString("TitleHeadingLevel", "h2"); 71 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h2"); 72 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 73 string titleTextOpacity = Model.Item.GetString("TitleTextOpacity", "opacity-100"); 74 string titleCssClass = Model.Item.GetString("TitleCssClass", string.Empty); 75 string titleSpacingBottomDesktop = Model.Item.GetRawValueString("TitleSpacingBottomDesktop", "default"); 76 titleSpacingBottomDesktop = titleSpacingBottomDesktop != "default" ? titleSpacingBottomDesktop : string.Empty; 77 string titleSpacingBottomMobile = Model.Item.GetRawValueString("TitleSpacingBottomMobile", "default"); 78 titleSpacingBottomMobile = titleSpacingBottomMobile != "default" ? titleSpacingBottomMobile : string.Empty; 79 80 string subtitle = Model.Item.GetString("Subtitle", string.Empty).Replace(System.Environment.NewLine, "<br>"); 81 string subtitleHeadingLevel = Model.Item.GetString("SubtitleHeadingLevel", "p"); 82 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 83 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 84 string subtitleTextOpacity = Model.Item.GetString("SubtitleTextOpacity", "opacity-100"); 85 string subtitleCssClass = Model.Item.GetString("SubtitleCssClass", string.Empty); 86 string subtitleSpacingBottomDesktop = Model.Item.GetRawValueString("SubtitleSpacingBottomDesktop", "default"); 87 subtitleSpacingBottomDesktop = subtitleSpacingBottomDesktop != "default" ? subtitleSpacingBottomDesktop : string.Empty; 88 string subtitleSpacingBottomMobile = Model.Item.GetRawValueString("SubtitleSpacingBottomMobile", "default"); 89 subtitleSpacingBottomMobile = subtitleSpacingBottomMobile != "default" ? subtitleSpacingBottomMobile : string.Empty; 90 91 string text = Model.Item.GetString("Text", string.Empty); 92 string textFontSize = Model.Item.GetRawValueString("TextFontSize", "fs-6"); 93 string textColor = Model.Item.GetString("TextColor", "text-inherit"); 94 string TextOpacity = Model.Item.GetString("TextOpacity", "opacity-100"); 95 string textCssClass = Model.Item.GetString("TextCssClass", string.Empty); 96 string textSpacingBottomDesktop = Model.Item.GetRawValueString("TextSpacingBottomDesktop", "mb-lg-4"); 97 textSpacingBottomDesktop = textSpacingBottomDesktop != "default" ? textSpacingBottomDesktop : string.Empty; 98 string textSpacingBottomMobile = Model.Item.GetRawValueString("TextSpacingBottomMobile", "mb-3"); 99 textSpacingBottomMobile = textSpacingBottomMobile != "default" ? textSpacingBottomMobile : string.Empty; 100 101 string contentAlignment = Model.Item.GetRawValueString("ContentAlignment", "align-items-center justify-content-center"); 102 string contentTextAlignment = Model.Item.GetRawValueString("ContentTextAlignment", "text-start"); 103 string contentSpacingStartDesktop = Model.Item.GetRawValueString("ContentSpacingStartDesktop", "default"); 104 contentSpacingStartDesktop = contentSpacingStartDesktop != "default" ? contentSpacingStartDesktop : string.Empty; 105 string contentSpacingStartMobile = Model.Item.GetRawValueString("ContentSpacingStartMobile", "default"); 106 contentSpacingStartMobile = contentSpacingStartMobile != "default" ? contentSpacingStartMobile : string.Empty; 107 string contentSpacingEndDesktop = Model.Item.GetRawValueString("ContentSpacingEndDesktop", "default"); 108 contentSpacingEndDesktop = contentSpacingEndDesktop != "default" ? contentSpacingEndDesktop : string.Empty; 109 string contentSpacingEndMobile = Model.Item.GetRawValueString("ContentSpacingEndMobile", "default"); 110 contentSpacingEndMobile = contentSpacingEndMobile != "default" ? contentSpacingEndMobile : string.Empty; 111 string contentSpacingTopDesktop = Model.Item.GetRawValueString("ContentSpacingTopDesktop", "default"); 112 contentSpacingTopDesktop = contentSpacingTopDesktop != "default" ? contentSpacingTopDesktop : string.Empty; 113 string contentSpacingTopMobile = Model.Item.GetRawValueString("ContentSpacingTopMobile", "default"); 114 contentSpacingTopMobile = contentSpacingTopMobile != "default" ? contentSpacingTopMobile : string.Empty; 115 string contentSpacingBottomDesktop = Model.Item.GetRawValueString("ContentSpacingBottomDesktop", "default"); 116 contentSpacingBottomDesktop = contentSpacingBottomDesktop != "default" ? contentSpacingBottomDesktop : string.Empty; 117 string contentSpacingBottomMobile = Model.Item.GetRawValueString("ContentSpacingBottomMobile", "default"); 118 contentSpacingBottomMobile = contentSpacingBottomMobile != "default" ? contentSpacingBottomMobile : string.Empty; 119 string contentCssClass = Model.Item.GetString("ContentCssClass", string.Empty); 120 121 var contentClasses = new List<string> { }; 122 if (contentSpacingStartDesktop != "default") { contentClasses.Add(contentSpacingStartDesktop.Trim()); } 123 if (contentSpacingStartMobile != "default") { contentClasses.Add(contentSpacingStartMobile.Trim()); } 124 if (contentSpacingEndDesktop != "default") { contentClasses.Add(contentSpacingEndDesktop.Trim()); } 125 if (contentSpacingEndMobile != "default") { contentClasses.Add(contentSpacingEndMobile.Trim()); } 126 if (contentSpacingTopDesktop != "default") { contentClasses.Add(contentSpacingTopDesktop.Trim()); } 127 if (contentSpacingTopMobile != "default") { contentClasses.Add(contentSpacingTopMobile.Trim()); } 128 if (contentSpacingBottomDesktop != "default") { contentClasses.Add(contentSpacingBottomDesktop.Trim()); } 129 if (contentSpacingBottomMobile != "default") { contentClasses.Add(contentSpacingBottomMobile.Trim()); } 130 if (!string.IsNullOrEmpty(contentCssClass)) { contentClasses.Add(contentCssClass); } 131 132 //Button 1 133 var button1Link = Model.Item.GetLink("Button1Link"); 134 var button1Label = Model.Item.GetString("Button1Label", string.Empty); 135 var button1Icon = Model.Item.GetRawValueString("Button1Icon"); 136 var button1IconPosition = Model.Item.GetRawValueString("Button1IconPosition", "right"); 137 var button1Style = Model.Item.GetRawValueString("Button1Style", "btn-primary"); 138 139 //Button 2 140 var button2Link = Model.Item.GetLink("Button2Link"); 141 var button2Label = Model.Item.GetString("Button2Label", string.Empty); 142 var button2Icon = Model.Item.GetRawValueString("Button2Icon"); 143 var button2IconPosition = Model.Item.GetRawValueString("Button2IconPosition", "right"); 144 var button2Style = Model.Item.GetRawValueString("Button2Style", "btn-primary"); 145 } 146 147 <div class="h-100 d-flex position-relative @(contentAlignment)@(theme) item_@Model.Item.SystemName.ToLower()"> 148 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top: var(--header-height, 150px)"></div> 149 <div class="d-inline-flex flex-column @(contentTextAlignment) @(string.Join(" ",contentClasses).Trim()) @(css)"> 150 151 @if (!string.IsNullOrEmpty(eyebrow)) 152 { 153 @RenderContent(eyebrow, eyebrowHeadingLevel, eyebrowFontSize, eyebrowColor, eyebrowTextOpacity, eyebrowSpacingBottomDesktop, eyebrowSpacingBottomMobile, eyebrowCssClass) 154 } 155 156 @if (!string.IsNullOrEmpty(title)) 157 { 158 @RenderContent(title, titleHeadingLevel, titleFontSize, titleColor, titleTextOpacity, titleSpacingBottomDesktop, titleSpacingBottomMobile, titleCssClass) 159 } 160 161 @if (!string.IsNullOrEmpty(subtitle)) 162 { 163 @RenderContent(subtitle, subtitleHeadingLevel, subtitleFontSize, subtitleColor, subtitleTextOpacity, subtitleSpacingBottomDesktop, subtitleSpacingBottomMobile, subtitleCssClass) 164 } 165 166 @if (!string.IsNullOrEmpty(text)) 167 { 168 @RenderContent(text, "div", textFontSize, textColor, TextOpacity, textSpacingBottomDesktop, textSpacingBottomMobile, $"mb-0-last-child {textCssClass}") 169 } 170 171 @if (button1Link is object || button2Link is object) 172 { 173 if (contentTextAlignment == "text-start") 174 { 175 contentAlignment = "justify-content-start"; 176 } 177 if (contentTextAlignment == "text-center") 178 { 179 contentAlignment = "justify-content-center"; 180 } 181 if (contentTextAlignment == "text-end") 182 { 183 contentAlignment = "justify-content-end"; 184 } 185 186 <div class="d-flex flex-wrap @(contentAlignment) gap-3"> 187 @if (button1Link is object && !string.IsNullOrEmpty(button1Label)) 188 { 189 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button1Link.IsExternal ? "target=\"_blank\"" : string.Empty; 190 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button1Link.IsExternal ? "rel=\"noopener\"" : string.Empty; 191 192 <a href="@button1Link.Url" @target @rel class="btn @(button1Style)"> 193 @if (button1Icon is object) 194 { 195 <span class="d-flex align-items-center gap-1 @(button1IconPosition)"> 196 @button1Label 197 @if (System.IO.Path.GetExtension(button1Icon).ToLower() == ".svg") 198 { 199 if (!button1Icon.ToLower().Contains("none") && button1Icon != string.Empty) 200 { 201 <span class="icon-auto"> 202 @ReadFile(button1Icon) 203 </span> 204 } 205 } 206 </span> 207 } 208 else 209 { 210 @button1Label 211 } 212 </a> 213 } 214 215 @if (button2Link is object && !string.IsNullOrEmpty(button1Label)) 216 { 217 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button2Link.IsExternal ? "target=\"_blank\"" : string.Empty; 218 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && button2Link.IsExternal ? "rel=\"noopener\"" : string.Empty; 219 220 <a href="@button2Link.Url" @target @rel class="btn @(button2Style)"> 221 @if (button2Icon is object) 222 { 223 <span class="d-flex align-items-center gap-1 @(button2IconPosition)"> 224 @button2Label 225 @if (System.IO.Path.GetExtension(button2Icon).ToLower() == ".svg") 226 { 227 if (!button2Icon.ToLower().Contains("none") && button2Icon != string.Empty) 228 { 229 <span class="icon-auto"> 230 @ReadFile(button2Icon) 231 </span> 232 } 233 } 234 </span> 235 } 236 else 237 { 238 @button2Label 239 } 240 </a> 241 } 242 </div> 243 } 244 @if (!string.IsNullOrEmpty(Model.ModuleSystemName)) 245 { 246 <div class="item_@Model.Item.SystemName.ToLower() @textSpacingBottomDesktop @textSpacingBottomMobile mb-0-last-child mt-3"> 247 @Model.GetModuleOutput() 248 </div> 249 } 250 </div> 251 </div> 252
By clicking 'Accept All' you consent that we may collect information about you for various purposes, including: Statistics and Marketing