Error executing template "Designs/MavomSpecialtyChemicals_generated/Paragraph/Carousel.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_731a7cf16a2f4f619df051bec76db0ff.Execute() in D:\virtual_hosts\Mavom_Production\files\Templates\Designs\MavomSpecialtyChemicals_generated\Paragraph\Carousel.cshtml:line 17
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.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb; 3 @using Dynamicweb.Content.Items; 4 @using Bluedesk.DynamicWeb.ItemTypes; 5 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 6 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 7 @using Bluedesk.Tools.Generic.ExtensionMethods 8 @using System.Linq; 9 @using Dynamicweb.Content; 10 11 <!-- FIX NEEDED: behaviour when all the items are full height images (for instance logo slider)?? --> 12 13 @{ 14 Carousel _data = ItemManager.Storage.GetById<Carousel>(Pageview.CurrentParagraph.ItemId ?? "0"); 15 16 var paragraphID = Pageview.CurrentParagraph.ID; 17 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user 18 var classFullWidth = !_data.Fullwidth ? "container" : "w-full"; // If slider or multicolumn has to be in container or full width of the page 19 } 20 21 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 22 @using Dynamicweb; 23 @using Dynamicweb.Content.Items; 24 @using Bluedesk.DynamicWeb.ItemTypes; 25 26 @functions { 27 28 Dictionary<string, string> GetFontConfiguration(string TextColor, FontConfigurationItemTab FontConfiguration) 29 { 30 31 Dictionary<string, string> FontConfig = new Dictionary<string, string>() 32 { 33 { "textColor" , TextColor }, 34 { "fontSize" , FontConfiguration.FontSize }, 35 { "lineHeight", FontConfiguration.LineHeight}, 36 { "fontFamily" , FontConfiguration.FontConfiguration.FontFamily }, 37 { "fontWeight" , FontConfiguration.FontWeight }, 38 { "fontStyle" , FontConfiguration.FontStyle } 39 }; 40 41 return FontConfig; 42 } 43 44 } 45 46 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 47 @using Dynamicweb; 48 @using Dynamicweb.Content.Items; 49 @using Bluedesk.DynamicWeb.ItemTypes; 50 51 52 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 53 @using Dynamicweb; 54 @using Dynamicweb.Content.Items; 55 @using Bluedesk.DynamicWeb.ItemTypes; 56 57 @helper RenderButton(string btnLink, string btnClass, string btnText, string ariaLabel = "", bool newWindow = false, string btnIcon = "", string btnExtraClass = "", string btnTextClass = "", string btnIconClass = "") 58 { 59 if(string.IsNullOrWhiteSpace(btnIcon)) { 60 btnIcon = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 61 } 62 string target = newWindow ? "_blank" : "_self"; 63 string ariaText = !string.IsNullOrWhiteSpace(ariaLabel) ? "aria-label='" + ariaLabel + "'" : ""; 64 65 if (!string.IsNullOrWhiteSpace(btnLink) && !string.IsNullOrWhiteSpace(btnText)) 66 { 67 <a href="@btnLink" class="btn @btnClass @btnExtraClass" target="@target" @ariaText> 68 <span class="btn__text @btnTextClass">@btnText</span> 69 <i class="btn__icon @btnIconClass @btnIcon"></i> 70 </a> 71 } 72 } 73 74 @{ 75 76 var colorService = new ColorSwatchService(); 77 78 string fullWidthContainerClass = _data.Fullwidth ? "" : "container"; 79 80 string backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundConfiguration.BackgroundClass) : ""; 81 string backgroundStyle = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundColor) ? $"background-color: {_data.BackgroundConfiguration.BackgroundColor}; " : ""; 82 backgroundStyle += !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundImage) ? $"background-image: url({_data.BackgroundConfiguration.BackgroundImage}); " : ""; 83 } 84 85 86 @functions { 87 string getbackgroundclass(string backgroundClass) 88 { 89 return !string.IsNullOrWhiteSpace(backgroundClass) ? string.Format("bg-{0}", backgroundClass) : ""; 90 } 91 } 92 93 @helper CTAParagraphImage( 94 ParagraphImageResizable Image, 95 bool hasContent, 96 bool ImageAsBackground, 97 string ImagePosition, 98 bool ParallaxImage, 99 bool Fullwidth, 100 string imagesHeight, 101 int paragraphHeight, 102 double ColumnWidthSize, 103 int AnimationDuration = 300, 104 bool AnimateHalfBlock = false 105 ) 106 { 107 if (!string.IsNullOrWhiteSpace(Image.Image)) 108 { 109110 string image = !string.IsNullOrWhiteSpace(Image.Image) ? Image.Image : null; 111 imagesHeight = hasContent ? imagesHeight : "100%"; 112 imagesHeight = !string.IsNullOrWhiteSpace(imagesHeight) ? "height: " + imagesHeight + ";" : ""; 113114 string imageParrallax = ParallaxImage ? "rellax" : ""; 115 string imageAsBackground = ImageAsBackground ? "cta-paragraph__image--is-background" : ""; 116 double imageWidth = 2000; 117118 imageWidth = Fullwidth ? imageWidth : 1200; 119 imageWidth = !ImageAsBackground ? imageWidth * ColumnWidthSize : imageWidth; 120121 string strImageWidth = imageWidth + "px"; 122 string strImageWidthSize = imageWidth + "w"; 123124 string ImageUrl; 125 if (image.EndsWith(".gif")) 126 { 127 ImageUrl = image; 128 } 129 else 130 { 131 ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + image + "&Crop=0&Compression=80"; 132 } 133134 string animationDirection = AnimateHalfBlock ? ImagePosition.Equals("right") ? "fade-left" : "fade-right" : ""; 135136 if (!string.IsNullOrWhiteSpace(Image.Image)) 137 { 138139 <figure class="cta-paragraph__image-container @imageAsBackground @Image.PositionY @Image.PositionX" style="@imagesHeight" data-aos="@animationDirection" data-aos-duration="@AnimationDuration"> 140141 <picture class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 142 @if (ImageUrl.EndsWith(".gif")) 143 { 144 <source media="(max-width: 400px)" srcset="@ImageUrl&Width=400"> 145 <source media="(max-width: 994px)" srcset="@ImageUrl&Width=994"> 146 <img src="@ImageUrl" loading="lazy" alt="@Image.ImageAlt" class="cta-paragraph__image @Image.BackgroundSize @imageParrallax" width="1980" height="500"> 147 } 148 else 149 { 150 <source media="(max-width: 400px)" srcset="@ImageUrl&Width=400"> 151 <source media="(max-width: 994px)" srcset="@ImageUrl&Width=994"> 152 <img src="@ImageUrl&Width=@imageWidth" loading="lazy" alt="@Image.ImageAlt" class="cta-paragraph__image @Image.BackgroundSize @imageParrallax" width="1980" height="500"> 153 } 154 </picture> 155156 </figure> 157 } 158 } 159 } 160161 @helper CTAParagraphContent( 162 int paragraphID, 163 string contentElementAlign, 164 ParagraphHeader Header, 165 ParagraphHeader SubHeader, 166 ParagraphContent Content, 167 CTAButton Button, 168 CTAButton ExtraButton, 169 ParagraphImage Image, 170 bool strCenterVertical, 171 Dictionary<string, string> subheaderFontConfig, 172 Dictionary<string, string> headerFontConfig, 173 Dictionary<string, string> contentFontConfig, 174 string ImagePosition = "", 175 int AnimationDuration = 300, 176 bool AnimateHalfBlock = false 177 ) 178 { 179180 bool hasImage = !string.IsNullOrWhiteSpace(Image.Image) ? true : false; 181 string noImageClass = hasImage ? "" : "no-image"; 182183 string centerTextClass = strCenterVertical ? "text-center" : ""; 184 string centerContent = !string.IsNullOrWhiteSpace(Image.Image) ? "" : "cta-paragraph__content--center"; 185186 string paragraphInstanceClass = "cta-paragraph__content--" + paragraphID; 187188 string animationDirection = (AnimateHalfBlock && hasImage) ? ImagePosition.Equals("right") ? "fade-right" : "fade-left" : ""; 189190 if (!string.IsNullOrWhiteSpace(Button.ButtonText) || !string.IsNullOrWhiteSpace(Content.Text) || !string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 191 { 192193 <style> 194 .multicolumn--@paragraphID .cta-paragraph .cta-paragraph__subheader, 195 .cta-paragraph--@paragraphID .cta-paragraph__subheader { 196 @RenderFontConfig(subheaderFontConfig) 197 } 198199 .@paragraphInstanceClass .cta-paragraph__header { 200 @RenderFontConfig(headerFontConfig) 201 } 202203 .@paragraphInstanceClass .cta-paragraph__text p, 204 .@paragraphInstanceClass .cta-paragraph__text li { 205 @RenderFontConfig(contentFontConfig) 206 } 207 </style> 208209 <section class="cta-paragraph__content @paragraphInstanceClass @centerContent @noImageClass" data-aos="@animationDirection" data-aos-duration="@AnimationDuration"> 210211 <article class="cta-paragraph__content-container @noImageClass"> 212213 @if (!string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 214 { 215 <header class="cta-paragraph__header @centerTextClass"> 216 @if (SubHeader != null) 217 { 218 @SubHeader.HeaderFormatted("cta-paragraph__subheader") 219 } 220 @Header.HeaderFormatted("cta-paragraph__header") 221 </header> 222 } 223224 @if (!string.IsNullOrWhiteSpace(Content.Text)) 225 { 226 <div class="cta-paragraph__text @centerTextClass">@Content.Text</div> 227 } 228229 @if (!string.IsNullOrWhiteSpace(Button.ButtonLink) && !string.IsNullOrWhiteSpace(Button.ButtonText)) 230 { 231 <nav class="cta-paragraph__btn-navigation"> 232 @RenderButton(Button.ButtonLink, Button.Configuration.ButtonClass, Button.ButtonText, Button.ButtonAriaLabel, Button.NewWindow, "", "cta-paragraph__btn", "cta-paragraph__btn-label", "cta-paragraph__btn-icon") 233 @RenderButton(ExtraButton.ButtonLink, ExtraButton.Configuration.ButtonClass, ExtraButton.ButtonText, ExtraButton.ButtonAriaLabel, ExtraButton.NewWindow, "", "cta-paragraph__btn", "cta-paragraph__btn-label", "cta-paragraph__btn-icon") 234 </nav> 235 } 236237 </article> 238 </section> 239240 } 241242 } 243244 @helper CTAParagraphVideo(ParagraphVideo Video, string imagesHeight) 245 { 246 if (!string.IsNullOrWhiteSpace(Video.YoutubeLink) || !string.IsNullOrWhiteSpace(Video.VimeoLink)) 247 { 248 string YoutubeID = Video.YoutubeId; 249 string YoutubeLink = Video.YoutubeLink; 250251 string VimeoID = Video.VimeoId; 252 string VimeoLink = Video.VimeoLink; 253254 int CleanVideo = Video.Clean ? 1 : 0; 255 int ShowControls = Video.ShowControls ? 1 : 0; 256 int AutoPlay = Video.AutoPlay ? 1 : 0; 257 int LoopVideo = Video.LoopVideo ? 1 : 0; 258 int MuteAudio = Video.MuteAudio ? 1 : 0; 259 string hideControlsClass = Video.ShowControls ? "video-player-wrapper--hidecontrols" : ""; 260 string origin = Dynamicweb.Environment.Helpers.LinkHelper.GetHttpDomain(); 261 imagesHeight = !string.IsNullOrWhiteSpace(imagesHeight) ? "height: " + imagesHeight + ";" : ""; 262263 if (!string.IsNullOrWhiteSpace(YoutubeLink)) 264 { 265 <section class="cta-paragraph__video-container" style="@imagesHeight"> 266 <div class=""> 267 <div class="video-player-wrapper @hideControlsClass"> 268 <iframe class="video-player" loading="lazy" data-video="@YoutubeID" frameborder="0" allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" title="YouTube video player" src="https://www.youtube.com/embed/@YoutubeID?autoplay=@AutoPlay&amp;controls=@ShowControls&amp;loop=@LoopVideo&amp;playlist=@YoutubeID&amp;playsinline=1&amp;disablekb=1&amp;modestbranding=@CleanVideo&amp;mute=@MuteAudio&amp;rel=0&amp;enablejsapi=1&amp;origin=@origin"></iframe> 269 </div> 270 </div> 271 </section> 272 } 273 if (!string.IsNullOrWhiteSpace(VimeoLink)) 274 { 275 <section class="cta-paragraph__video-container" style="@imagesHeight"> 276 <div class=""> 277 <div class="video-player-wrapper"> 278 <iframe class="video-player" loading="lazy" data-video="@VimeoID" frameborder="0" allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" title="Vimeo video player" src="https://player.vimeo.com/video/@VimeoID?title=0&byline=0&portrait=0&autoplay=@AutoPlay&controls=@ShowControls&loop=@LoopVideo&muted=@MuteAudio"></iframe> 279 </div> 280 </div> 281 </section> 282 } 283 } 284 } 285286 @helper CTAParagraphIcon(ParagraphIcon Icon, bool strCenterVertical) 287 { 288 if (!string.IsNullOrWhiteSpace(Icon.FaIcon)) 289 { 290 string centerIconClass = strCenterVertical ? "justify-center" : "justify-start"; 291 string iconSizeClass = string.Format("cta-paragraph__icon--{0}", Icon.FaIconSize); 292293 <div class="cta-paragraph__icon-container"> 294 <div class="cta-paragraph__icon-inner-container @centerIconClass"> 295 <span class="cta-paragraph__icon @iconSizeClass">@Icon.FaIcon</span> 296 </div> 297 </div> 298 } 299 } 300301 @helper RenderFontConfig(Dictionary<string, string> FontConfig) 302 { 303 if (!string.IsNullOrWhiteSpace(FontConfig["textColor"])) 304 { 305 <text>color: @FontConfig["textColor"] !important;</text> 306 } 307308 if (!string.IsNullOrWhiteSpace(FontConfig["fontSize"])) 309 { 310 <text>font-size: @FontConfig["fontSize"] !important;</text> 311 } 312 if (!string.IsNullOrWhiteSpace(FontConfig["lineHeight"])) 313 { 314 <text>line-height: @FontConfig["lineHeight"] !important;</text> 315 } 316 if (!string.IsNullOrWhiteSpace(FontConfig["fontFamily"])) 317 { 318 <text>font-family: @FontConfig["fontFamily"] !important;</text> 319 } 320 if (!string.IsNullOrWhiteSpace(FontConfig["fontWeight"])) 321 { 322 <text>font-weight: @FontConfig["fontWeight"] !important;</text> 323 } 324 if (!string.IsNullOrWhiteSpace(FontConfig["fontStyle"])) 325 { 326327 if (FontConfig["fontStyle"] == "firstupper") { 328 FontConfig["fontStyle"] = "none"; 329 } 330331 <text>text-transform: @FontConfig["fontStyle"] !important;</text> 332333 } 334 } 335336337 @{ 338339 string backgroundImageRepeatClass = _data.BackgroundConfiguration.BackgroundImageRepeat; 340 string backgroundImageSizeClass = ""; 341342 string BackgroundImagePositionX = _data.BackgroundConfiguration.BackgroundImagePositionX; 343 string BackgroundImagePositionY = _data.BackgroundConfiguration.BackgroundImagePositionY; 344345 string BackgroundImagePositionClass = ""; 346347 if (backgroundImageRepeatClass == "no-repeat") 348 { 349 BackgroundImagePositionClass = BackgroundImagePositionY + "-" + BackgroundImagePositionX; 350 backgroundImageSizeClass = _data.BackgroundConfiguration.BackgroundImageSize; 351 } 352353 string ctaBackgroundColor = _data.BackgroundConfiguration.BackgroundColor; 354355 ctaBackgroundColor = colorService.GetHexColor(Pageview.AreaID, ctaBackgroundColor); 356357 string contentBackgroundColor = _data.BackgroundConfiguration.contentBackgroundColor; 358359 string contentGutterClass = _data.BackgroundConfiguration.contentGutter; 360 string BackgroundPadding = _data.BackgroundConfiguration.backgroundPadding; 361362 contentBackgroundColor = colorService.GetHexColor(Pageview.AreaID, contentBackgroundColor); 363364 } 365366 <style> 367368 @@media screen and (min-width: 991px) { 369 .multicolumn--@paragraphID { 370 background-color: @ctaBackgroundColor; 371 } 372373 .multicolumn--@paragraphID .cta-paragraph { 374 background-color: @contentBackgroundColor; 375 } 376 } 377378 .flickity-viewport{ 379 width: 100%; 380 } 381382 .header__cta{ 383 display: flex; 384 align-items: center; 385 } 386387 </style> 388389 @if (amountColumns > 0) 390 { 391 <div class="multicolumn overflow-hidden multicolumn--@paragraphID @backgroundClass @_data.CssClass @backgroundImageRepeatClass @BackgroundImagePositionClass @backgroundImageSizeClass @contentGutterClass @BackgroundPadding" data-paragraphid="@paragraphID" id="@paragraphID" style="@backgroundStyle"> 392 <div class="@classFullWidth">@RenderContentArea(_data, paragraphID)</div> 393 </div> 394 } 395396 @helper RenderContentArea(Carousel _data, int paragraphID) 397 { 398399 var subheaderFontConfig = GetFontConfiguration(_data.BackgroundConfiguration.CTASubheaderTextColor, _data.BackgroundConfiguration.FontConfigurationSubheader); 400 var headerFontConfig = GetFontConfiguration(_data.BackgroundConfiguration.CTAHeaderTextColor, _data.BackgroundConfiguration.FontConfigurationHeader); 401 var contentFontConfig = GetFontConfiguration(_data.BackgroundConfiguration.CTAContentTextColor, _data.BackgroundConfiguration.FontConfigurationContent); 402403 var colorService = new ColorSwatchService(); 404405 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user 406407 string centerTextClass = _data.CenterText ? "items-center text-center" : "items-start text-left"; 408409 /* Specific for Carousel */ 410411 int colDisplay = _data.ColumnsDisplay; // Amount of displayed column within one screen 412413 bool fullWidth = _data.Fullwidth; // If slider or multicolumn has to be in container or full widthof the page 414 bool infiniteLoop = _data.Infinite; 415 bool autoPlay = _data.AutoPlay; 416 bool controls = _data.AddControls; 417 bool duration = _data.Duration; 418 bool showDots = _data.ShowDots; // If slider or multicolumn has to be in container or full widthof the page 419 int colAmount = 1; 420421 bool imagesOnlyBool = checkOnlyImages(_data); // Check if this carousel contains only images (logo slider) 422423 subheaderFontConfig["textColor"] = colorService.GetHexColor(Pageview.AreaID, subheaderFontConfig["textColor"]); 424 headerFontConfig["textColor"] = colorService.GetHexColor(Pageview.AreaID, headerFontConfig["textColor"]); 425 contentFontConfig["textColor"] = colorService.GetHexColor(Pageview.AreaID, contentFontConfig["textColor"]); 426427 bool Shadow = _data.BackgroundConfiguration.contentShadow; 428 string shadowClass = Shadow ? "contentShadow" : ""; 429430 if (!string.IsNullOrWhiteSpace(@_data.Header.HeaderFormatted())) 431 { 432 <header class="multicolumn__header-wrapper"> 433 @_data.Header.HeaderFormatted("multicolumn__header") 434 </header> 435 } 436437 string carouselHeight = "auto"; 438439 if (imagesOnlyBool && _data.ImageHeight != 0) 440 { 441 carouselHeight = _data.ImageHeight.ToString() + "px"; 442 } 443444 if ((colDisplay <= amountColumns) && (colDisplay != 0)) 445 { 446 string flexBasis = 100 / @colDisplay + "%"; 447448 <section class="carousel multicolumn" 449 data-columns="@colAmount" 450 data-dots="@showDots" 451 data-loop="@infiniteLoop" 452 data-autoplay="@autoPlay" 453 data-controls="@controls" 454 data-duration="@duration" 455 style="height: @carouselHeight;"> 456457 @foreach (var column in _data.CarouselItems) 458 { 459460 bool hasContent = !string.IsNullOrWhiteSpace(column.Button.ButtonText) || !string.IsNullOrWhiteSpace(column.Content.Text) || !string.IsNullOrWhiteSpace(column.Header.HeaderFormatted()); 461462 string image = column.Image.Image; 463 string imagesHeight = _data.ImageHeight == 0 ? "auto" : _data.ImageHeight.ToString() + "px"; 464 string ImageContainerFixed = hasContent ? "cta-paragraph__image-container--fixed" : ""; 465 string ImageAsBackground = (column.BackgroundConfiguration.ConfigurationName == "Image as Background") ? "cta-paragraph__image--is-background" : ""; 466467 string coverImage = ""; 468469 string figureHeight = !hasContent ? "flex-grow:1" : "height:" + imagesHeight; 470 string TempClass = imagesOnlyBool ? "imageOnly" : "hasContent"; 471 string ImageOnlyImageHeight = imagesOnlyBool ? "height:" + imagesHeight + ";" : "height:auto;"; 472473 if (!imagesOnlyBool) 474 { 475 imagesHeight = hasContent ? imagesHeight : imagesHeight = "100%"; 476 } 477478 /*This is work around created by Alla to enable cover mode for stand alone pictures*/ 479 if (!hasContent && column.Image.BackgroundSize == "bg-cover") 480 { 481 coverImage = "height:100%;"; 482 } 483484 <div class="multicolumn__item carousel-cell-wrap" style="display: flex; min-height:100%; @ImageOnlyImageHeight width: @flexBasis; @coverImage"> 485486 <section class="cta-paragraph carousel-cell" style="min-height: @imagesHeight; @ImageOnlyImageHeight"> 487 @{ 488 string newWindow = column.Button.NewWindow ? "target='_blank'" : ""; 489 string ariaLabel = !string.IsNullOrWhiteSpace(column.Button.ButtonAriaLabel) ? "aria-label='" + column.Button.ButtonAriaLabel + "'" : ""; 490 bool clickableBlock = !string.IsNullOrWhiteSpace(column.Button.ButtonLink) && _data.Clickable; 491 string clickableClass = clickableBlock ? "cta-paragraph__container--clickable" : ""; 492493 double ColumnAmount = colDisplay; 494 double ColumnWidthSize = 1 / ColumnAmount; 495 } 496497 @CTAParagraphImage( 498 column.Image, 499 hasContent, 500 false, 501 null, 502 false, 503 _data.Fullwidth, 504 imagesHeight, 505 0, 506 ColumnWidthSize 507 ) 508 @CTAParagraphContent( 509 paragraphID, 510 "align-left", 511 column.Header, 512 column.Subheader, 513 column.Content, 514 column.Button, 515 column.ExtraButton, 516 column.Image, 517 false, 518 subheaderFontConfig, 519 headerFontConfig, 520 contentFontConfig 521 ) 522523 @if (clickableBlock) 524 { 525 <a href="@column.Button.ButtonLink" class="cta-paragraph__clickable" @newWindow @ariaLabel></a> 526 } 527 </section> 528529 </div> 530 } 531 </section> 532 } 533 else if (colDisplay > amountColumns) 534 { 535 <div>Error: you cant display columns more than you filled in the backend</div> 536 } 537 } 538539 @functions{ 540 // Check if this carousel contains only images (logo slider) 541 bool checkOnlyImages(Carousel _data) 542 { 543544 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user 545 int emptyColumn = 0; 546547 // Loop through all the columns 548 foreach (var column in _data.CarouselItems) 549 { 550 // If button is empty AND content is empty AND header is empty => this is img only 551 if (string.IsNullOrWhiteSpace(column.Button.ButtonText) && string.IsNullOrWhiteSpace(column.Content.Text) && string.IsNullOrWhiteSpace(column.Header.HeaderFormatted())) 552 { 553 emptyColumn++; 554 } 555 } 556557 bool emptyColumnResult = emptyColumn == amountColumns ? true : false; 558559 return emptyColumnResult; 560561 } 562 } 563
To Top