Skip to content

Commit 5489176

Browse files
committed
added content-type dropdown values example
1 parent c611051 commit 5489176

File tree

2 files changed

+71
-3
lines changed

2 files changed

+71
-3
lines changed

.data/app.xml

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
2-
<SexyContent FileVersion="07.00.00" MinimumRequiredVersion="07.00.00" ModuleVersion="11.13.00" ExportDate="2021-04-14T07:56:21.1324502+02:00">
2+
<SexyContent FileVersion="07.00.00" MinimumRequiredVersion="07.00.00" ModuleVersion="11.13.00" ExportDate="2021-04-14T08:11:53.5732942+02:00">
33
<Header>
44
<App Guid="efe3b9cf-1382-40b3-bee2-34becb5351bc" />
55
<Language Default="en-us" />
@@ -341,6 +341,59 @@
341341
</Entity>
342342
<Entity AssignmentObjectType="EAV Field Properties" AttributeSetStaticName="@entity-default" AttributeSetName="@entity-default" EntityGUID="7e294774-38e7-4891-b5ce-1fbb555cfb2d" Json="True" KeyNumber="2869" />
343343
</Attribute>
344+
<Attribute StaticName="Sex" Type="String" IsTitle="false">
345+
<Entity AssignmentObjectType="EAV Field Properties" AttributeSetStaticName="@All" AttributeSetName="@All" EntityGUID="0938a3fa-a7ee-49b1-af70-65061fec3954" Json="True" KeyNumber="4652">
346+
<Value Key="CustomJavaScript" Value="" Type="String">
347+
<Dimension DimensionID="141" ReadOnly="false" />
348+
</Value>
349+
<Value Key="DefaultValue" Value="" Type="String">
350+
<Dimension DimensionID="141" ReadOnly="false" />
351+
</Value>
352+
<Value Key="Disabled" Value="False" Type="Boolean">
353+
<Dimension DimensionID="141" ReadOnly="false" />
354+
</Value>
355+
<Value Key="DisableTranslation" Value="False" Type="Boolean">
356+
<Dimension DimensionID="141" ReadOnly="false" />
357+
</Value>
358+
<Value Key="InputType" Value="string-dropdown" Type="String">
359+
<Dimension DimensionID="141" ReadOnly="false" />
360+
</Value>
361+
<Value Key="Name" Value="Sex" Type="String">
362+
<Dimension DimensionID="141" ReadOnly="false" />
363+
</Value>
364+
<Value Key="Notes" Value="" Type="String">
365+
<Dimension DimensionID="141" ReadOnly="false" />
366+
</Value>
367+
<Value Key="Placeholder" Value="" Type="String">
368+
<Dimension DimensionID="141" ReadOnly="false" />
369+
</Value>
370+
<Value Key="Required" Value="False" Type="Boolean">
371+
<Dimension DimensionID="141" ReadOnly="false" />
372+
</Value>
373+
<Value Key="ValidationRegExJavaScript" Value="" Type="String">
374+
<Dimension DimensionID="141" ReadOnly="false" />
375+
</Value>
376+
<Value Key="VisibleInEditUI" Value="True" Type="Boolean">
377+
<Dimension DimensionID="141" ReadOnly="false" />
378+
</Value>
379+
</Entity>
380+
<Entity AssignmentObjectType="EAV Field Properties" AttributeSetStaticName="@String" AttributeSetName="@String" EntityGUID="5c811aa6-34bb-4ddb-bb68-520e6d3e0100" Json="True" KeyNumber="4652">
381+
<Value Key="DropdownValues" Value="" Type="String">
382+
<Dimension DimensionID="141" ReadOnly="false" />
383+
</Value>
384+
<Value Key="InputType" Value="" Type="String">
385+
<Dimension DimensionID="141" ReadOnly="false" />
386+
</Value>
387+
</Entity>
388+
<Entity AssignmentObjectType="EAV Field Properties" AttributeSetStaticName="@string-dropdown" AttributeSetName="@string-dropdown" EntityGUID="cd6c6206-1841-4b32-9072-a9e4a37a375c" Json="True" KeyNumber="4652">
389+
<Value Key="DropdownValues" Value="Unknown:&#xA;Male:m&#xA;Female:f&#xA;Non-binary:nb" Type="String">
390+
<Dimension DimensionID="141" ReadOnly="false" />
391+
</Value>
392+
<Value Key="EnableTextEntry" Value="False" Type="Boolean">
393+
<Dimension DimensionID="141" ReadOnly="false" />
394+
</Value>
395+
</Entity>
396+
</Attribute>
344397
</Attributes>
345398
</AttributeSet>
346399
<AttributeSet StaticName="9588197a-3365-4ea8-9377-63ba70c333b2" Name="UiDemoData" Description="" Scope="2SexyContent" AlwaysShareConfiguration="false">
@@ -3514,6 +3567,8 @@
35143567
<Folder Id="3102" RelativePath="adam/Tutorial-Razor/hjdIjeCXgU2_y6gcEiJkPw/" />
35153568
<Folder Id="3100" RelativePath="adam/Tutorial-Razor/lkSe34OoCkek0zycr6nENQ/" />
35163569
<Folder Id="3094" RelativePath="adam/Tutorial-Razor/n97Ml8Vl10mZADcbKmmBKw/" />
3570+
<Folder Id="10562" RelativePath="adam/Tutorial-Razor/rHgUNyVUF0aXmDUb4o6SDg/" />
3571+
<Folder Id="10563" RelativePath="adam/Tutorial-Razor/rHgUNyVUF0aXmDUb4o6SDg/Mugshot/" />
35173572
<Folder Id="3096" RelativePath="adam/Tutorial-Razor/t2CvZ6b2A0SkiQawk1wHow/" />
35183573
<Folder Id="3092" RelativePath="adam/Tutorial-Razor/Tm5yNs0hAEyc6HIID4k12g/" />
35193574
<Folder Id="10560" RelativePath="adam/Tutorial-Razor/YjBw9OeCIkC5x4Pqo-_q9w/" />

data/_910-content-type.cshtml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,26 @@
1717
@{
1818
var type = AsEntity(Content).Type;
1919
var attributes = type.Attributes as IEnumerable<IContentTypeAttribute>;
20+
var sexAttr = attributes.First(t => t.Name == "Sex");
21+
// Check the metadata for the DropdownValues in the type @string-dropdown
22+
var sexDropdown = sexAttr.Metadata.GetBestValue<string>("DropdownValues", "@string-dropdown");
2023
}
21-
<ul>
24+
<ol>
2225
<li>Type object: <a href="https://docs.2sxc.org/api/dot-net/ToSic.Eav.Data.IContentType.html" target="_blank">@type 🔗</a></li>
2326
<li>Type Name: "@type.Name"</li>
2427
<li>Type Internal Name: "@type.StaticName"</li>
2528
<li>Type of the Awards field: "@attributes.First(t => t.Name == "Awards").Type"</li>
26-
</ul>
29+
<li>
30+
Values in the <code>Sex</code> field (@sexAttr.Type) dropdown
31+
<ul>
32+
@foreach (var s in sexDropdown.Split(new [] { '\r', '\n' }))
33+
{
34+
var parts = s.Split(':');
35+
<li>@parts[0] = '@(parts.Length > 0 ? parts[1] : "")'</li>
36+
}
37+
</ul>
38+
</li>
39+
</ol>
2740

2841
<h3>Properties / Attributes</h3>
2942
<p>

0 commit comments

Comments
 (0)