In some advanced cases you want to find out information about a specific content-type.
Sex
@inherits Custom.Hybrid.RazorTyped @using ToSic.Eav.Data; @{ var type = MyItem.Type; var attributes = type.Attributes as IEnumerable<IContentTypeAttribute>; var sexAttr = attributes.First(t => t.Name == "Sex"); // Check the metadata for the DropdownValues in the type @string-dropdown var sexDropdown = sexAttr.Metadata.GetBestValue<string>("DropdownValues", "@string-dropdown"); } <ol> <li>Type Name: "@type.Name"</li> <li>Type Internal Name: "@type.StaticName"</li> <li>Type of the Awards field: "@attributes.First(t => t.Name == "Awards").Type"</li> <li> Values in the <code>Sex</code> field (@sexAttr.Type) dropdown <ul> @foreach (var s in sexDropdown.Split(new [] { '\r', '\n' })) { var parts = s.Split(':'); <li>@parts[0] = '@(parts.Length > 0 ? parts[1] : "")'</li> } </ul> </li> </ol>
This is how this view would be configured for this sample.
Read more about attributes in the docs 🔗
String
DateTime
Hyperlink
Entity
Number
Boolean
@inherits Custom.Hybrid.RazorTyped @{ var type = MyItem.Type; } <ul> @foreach (var attr in type.Attributes) { <li> @* This will get the label from the metadata entity *@ @(attr.Metadata.GetBestValue<string>("Name", "@All")) (@attr.Name, <code>@attr.Type</code> = typeId @((int)attr.Type)) </li> } </ul>