Last active
September 23, 2024 09:06
-
-
Save sebastiandammark/dcb588f6cd6d8d291af9cdedda596b8b to your computer and use it in GitHub Desktop.
Unifying partial between BlockGridItem and BlockListItem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<IBlockReference> | |
@using Umbraco.Cms.Web.Common.PublishedModels | |
@{ | |
var block = Model switch | |
{ | |
BlockGridItem gridItem => gridItem.Content as TextBlock, | |
BlockListItem listItem => listItem.Content as TextBlock, | |
_ => null | |
}; | |
var settings = Model switch | |
{ | |
BlockGridItem gridItem => gridItem.Settings as TextBlockSettings, | |
BlockListItem listItem => listItem.Settings as TextBlockSettings, | |
_ => null | |
}; | |
if(block != null){ | |
<div class="textblock"> | |
<h1>@block.Title</h1> | |
<div>@block.Text</div> | |
</div> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment