Closed skttl closed 6 years ago
Thanks for the PR @skttl , but I would prefer to disquss this issue http://issues.umbraco.org/issue/U4-10005 and hopefully make it possible the reuse core property value converters, e.g. like we already can reuse core directives/components and property editors.
Agree, that issue would be great to have in Umbraco.
man. 30. okt. 2017 kl. 11.55 skrev Bjarne Fyrstenborg < notifications@github.com>:
Closed #6 https://github.com/bjarnef/Switcher/issues/6.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bjarnef/Switcher/issues/6#event-1316413109, or mute the thread https://github.com/notifications/unsubscribe-auth/ADjcg2o5BeCs3K1L95b1FE-JR1PjHcPLks5sxasygaJpZM4QK6nZ .
I agree with @bjarnef that there should be a generic PropertyValueConverter
for this, but for a drop-in fix, the following code should do and could be included in the readme (since at first I didn't see the closed issue and PR):
[PropertyValueType(typeof(bool))]
[PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)]
public class SwitcherValueConverter : Umbraco.Core.PropertyEditors.ValueConverters.YesNoValueConverter
{
public override bool IsConverter(PublishedPropertyType propertyType)
{
return propertyType.PropertyEditorAlias == "Our.Umbraco.Switcher";
}
}
ModelsBuilder returns the value of this as an object. I created a value converter for it, so you get a boolean value.
PR coming