Commit 0ad47dcf authored by Mikael Lindemann's avatar Mikael Lindemann
Browse files

Downgrade Umbraco.Core internal package to 8.0.0 (this allows using the editor...

Downgrade Umbraco.Core internal package to 8.0.0 (this allows using the editor with strong types in pre 8.4.0).

Also, added composer to insert the converter prior to the json converter in the list of converters.
parent 71940e2c
......@@ -24,7 +24,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="UmbracoCms.Core" Version="8.4.0" />
<PackageReference Include="UmbracoCms.Core" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
......
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.PropertyEditors.ValueConverters;
namespace Appstract.UmbracoContactNumber
{
public class ContactNumberUserComposer : IUserComposer
{
public void Compose(Composition composition)
{
var converters = composition.PropertyValueConverters();
if (converters.Has<JsonValueConverter>())
{
composition.PropertyValueConverters().InsertBefore<JsonValueConverter, ContactNumberValueConverter>();
}
}
}
}
......@@ -7,18 +7,19 @@ namespace Appstract.UmbracoContactNumber
{
public class ContactNumberValueConverter : PropertyValueConverterBase
{
public override object ConvertIntermediateToObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview)
public override object ConvertIntermediateToObject(IPublishedElement owner, PublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview)
{
return inter;
}
public override object ConvertIntermediateToXPath(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview)
public override object ConvertIntermediateToXPath(IPublishedElement owner, PublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview)
{
return null;
}
public override object ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object source, bool preview)
public override object ConvertSourceToIntermediate(IPublishedElement owner, PublishedPropertyType propertyType, object source, bool preview)
{
if (!(source is string s))
{
return null;
......@@ -27,17 +28,17 @@ namespace Appstract.UmbracoContactNumber
return JsonConvert.DeserializeObject<ContactNumber>(s);
}
public override PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType)
public override PropertyCacheLevel GetPropertyCacheLevel(PublishedPropertyType propertyType)
{
return PropertyCacheLevel.Element;
}
public override Type GetPropertyValueType(IPublishedPropertyType propertyType)
public override Type GetPropertyValueType(PublishedPropertyType propertyType)
{
return typeof(ContactNumber);
}
public override bool IsConverter(IPublishedPropertyType propertyType)
public override bool IsConverter(PublishedPropertyType propertyType)
{
return propertyType.EditorAlias.Equals("AppstractUmbracoContactNumber");
}
......
......@@ -45,10 +45,10 @@
</iconUrl>
<license url="http://opensource.org/licenses/MIT">MIT License</license>
<url>https://gitlab.dev.appstract.dk/internal/umbracocontactnumber</url>
<requirements type="Strict">
<requirements>
<major>8</major>
<minor>1</minor>
<patch>2</patch>
<minor>0</minor>
<patch>0</patch>
</requirements>
</package>
<author>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment