Пример #1
0
        /// <summary>
        /// Gets the typed value of the Archetype property
        /// </summary>
        /// <param name="mapper">Umbraco mapper</param>
        /// <param name="archetypeProperty">Archetype property</param>
        /// <returns>Object of the required type</returns>
        private static object GetTypedValue(IUmbracoMapper mapper, ArchetypePropertyModel archetypeProperty)
        {
            switch (archetypeProperty.PropertyEditorAlias)
            {
            case "Umbraco.ContentPickerAlias":
                return(archetypeProperty.GetValue <IPublishedContent>());

            case "Umbraco.MultiNodeTreePicker":
                return(archetypeProperty.GetValue <IEnumerable <IPublishedContent> >());

            case "Umbraco.TinyMCEv3":
                return(archetypeProperty.GetValue <IHtmlString>());

            case "Imulus.Archetype":
                return(GetArchetypeCollection(mapper, archetypeProperty.GetValue <ArchetypeModel>()));

            default:
                return(archetypeProperty.Value);
            }
        }
Пример #2
0
        private static object GetTypedValue(ArchetypePropertyModel archetypeProperty)
        {
            switch (archetypeProperty.PropertyEditorAlias)
            {
            case "Umbraco.ContentPickerAlias":
            case "Umbraco.MediaPicker":
                IPublishedContent v = archetypeProperty.GetValue <IPublishedContent>();
                if (v == null)
                {
                    return("");
                }
                return(v);

            //case "Umbraco.MultiNodeTreePicker":
            //    return archetypeProperty.GetValue<IEnumerable<IPublishedContent>>();
            default:
                return(archetypeProperty.Value);
            }
        }