-
Notifications
You must be signed in to change notification settings - Fork 0
Advanced Configuration
Concrete has 2 main parts to the ConcreteContentTypes.config file. The first is described in Basic Configuration.
The second part is the ConcreteCSharpWriterSettings:
Basically Concrete has a series of 'CSharpWriters' which do the actual writing of our C#. Each CSharpWriter will work with one or more Property Editors. This section of the config file tells Concrete what CSharpWriters it has and what Property Editors they are used for.
Each <CSWriter> element must specify a single attribute of 'type' which is the fully qualified type name of the CSharpWriter and assembly it is located in:
<CSWriter type="Fully.Qualified.Type.Name, Assembly">
Each <CSWriter> element has a single child element of <SupportedTypes>. This then has a collection of <Type> child elements. These are used to list the PropertyEditors that this CSharpWriter will be used for.
<SupportedTypes>
<Type alias="Umbraco.UploadField" clrType="string" />
<Type alias="Umbraco.MultipleMediaPicker" />
</SupportedTypes>
The <Type> element has a required attribute 'alias' which is the Property Editor Alias. It then has a optional attribute of 'clrType'. If the clrType is specified then Concrete will use this when writing properties. If it isn't specified then it will attempt to use the PropertyValueConverters to work out the clr type of the property.
** A property editor can only be used with 1 CSharpWriter. **
This configuration allows Concrete to be flexible. You can create your own CSharpWriters for custom property editors or you can change the way that I have written the C# for existing supported editors!
How to create your own CSharpWriter
<ConcreteCSharpWriterSettings>
<CSharpWriters>
<CSWriter type="ConcreteContentTypes.Core.ModelGeneration.CSharpWriters.PropertyCSharpWriters.BasicUmbracoPropertyCSharpWriter, ConcreteContentTypes.Core">
<SupportedTypes>
<Type alias="Umbraco.ColorPickerAlias" clrType="string"/>
<Type alias="Umbraco.CheckBoxList" clrType="string"/>
<Type alias="Umbraco.Date" clrType="DateTime"/>
<Type alias="Umbraco.DateTime" clrType="DateTime"/>
<Type alias="Umbraco.DropDown" clrType="string"/>
<Type alias="Umbraco.DropDownMultiple" clrType="string"/>
<Type alias="Umbraco.NoEdit" clrType="string" />
<Type alias="Umbraco.Integer" clrType="int" />
<Type alias="Umbraco.TinyMCEv3" clrType="IHtmlString" />
<Type alias="Umbraco.TextboxMultiple" clrType="string" />
<Type alias="Umbraco.Textbox" clrType="string" />
<Type alias="Umbraco.TrueFalse" clrType="bool" />
<Type alias="Umbraco.Guid" clrType="Guid" />
<Type alias="Umbraco.EmailAddress" clrType="string" />
<Type alias="Umbraco.MarkdownEditor" clrType="IHtmlString" />
<Type alias="Umbraco.UploadField" clrType="string" />
<Type alias="RJP.MultiUrlPicker" />
<Type alias="AngularGoogleMaps" />
</SupportedTypes>
</CSWriter>
<CSWriter type="ConcreteContentTypes.Core.ModelGeneration.CSharpWriters.PropertyCSharpWriters.ContentPickerPropertyCSharpWriter, ConcreteContentTypes.Core">
<SupportedTypes>
<Type alias="Umbraco.ContentPickerAlias" clrType="IPublishedContent" />
</SupportedTypes>
</CSWriter>
<CSWriter type="ConcreteContentTypes.Core.ModelGeneration.CSharpWriters.PropertyCSharpWriters.MNTPPropertyCSharpWriter, ConcreteContentTypes.Core">
<SupportedTypes>
<Type alias="Umbraco.MultiNodeTreePicker" />
</SupportedTypes>
</CSWriter>
<CSWriter type="ConcreteContentTypes.Core.ModelGeneration.CSharpWriters.PropertyCSharpWriters.GridPropertyCSharpWriter, ConcreteContentTypes.Core">
<SupportedTypes>
<Type alias="Umbraco.Grid" clrType="GridContent" />
</SupportedTypes>
</CSWriter>
<CSWriter type="ConcreteContentTypes.Core.ModelGeneration.CSharpWriters.PropertyCSharpWriters.NestedContentCSharpWriter, ConcreteContentTypes.Core">
<SupportedTypes>
<Type alias="Our.Umbraco.NestedContent" />
</SupportedTypes>
</CSWriter>
<CSWriter type="ConcreteContentTypes.Core.ModelGeneration.CSharpWriters.PropertyCSharpWriters.MediaPickerPropertyCSharpWriter, ConcreteContentTypes.Core">
<SupportedTypes>
<Type alias="Umbraco.MediaPicker" />
</SupportedTypes>
</CSWriter>
<CSWriter type="ConcreteContentTypes.Core.ModelGeneration.CSharpWriters.PropertyCSharpWriters.MultipleMediaPickerPropertyCSharpWriter, ConcreteContentTypes.Core">
<SupportedTypes>
<Type alias="Umbraco.MultipleMediaPicker" />
</SupportedTypes>
</CSWriter>
</CSharpWriters>
</ConcreteCSharpWriterSettings>