Esempio n. 1
0
 /// <summary>
 /// Determines whether the property type is invariant.
 /// </summary>
 public static bool VariesByNothing(this PublishedPropertyType propertyType) => propertyType.Variations.VariesByNothing();
Esempio n. 2
0
 public override bool IsConverter(PublishedPropertyType propertyType)
 {
     return(Guid.Parse(Constants.PropertyEditors.TinyMCEv3).Equals(propertyType.PropertyEditorGuid));
 }
Esempio n. 3
0
 public override object ConvertSourceToXPath(PublishedPropertyType propertyType, object source, bool preview)
 {
     // source should come from ConvertSource and be a string (or null) already
     return(source);
 }
Esempio n. 4
0
 public override bool IsConverter(PublishedPropertyType propertyType)
 {
     return Umbraco.Core.Constants.PropertyEditors.MarkdownEditorAlias.Equals(propertyType.PropertyEditorAlias);
 }
Esempio n. 5
0
        public Type GetPropertyValueType(PublishedPropertyType propertyType)
        {
            var wrappedPropertyType = GetWrappedPropertyType(propertyType);

            return(wrappedPropertyType != null ? wrappedPropertyType.ClrType : typeof(string));
        }
        /// <summary>
        /// Convert the source array into a Video object
        /// </summary>
        /// <param name="propertyType">
        /// The published property type.
        /// </param>
        /// <param name="source">
        /// The value of the property
        /// </param>
        /// <param name="preview">
        /// The preview.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        public object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview)
        {
            var selectedVideos = new SimpleYouTube(source as List <SelectedVideo>);

            return(selectedVideos);
        }
Esempio n. 7
0
 public override PropertyCacheLevel GetPropertyCacheLevel(PublishedPropertyType propertyType) => PropertyCacheLevel.None;
 public Type GetPropertyValueType(PublishedPropertyType propertyType)
 => typeof(int);
 public PropertyCacheLevel GetPropertyCacheLevel(PublishedPropertyType propertyType)
 => _cacheLevel;
 public override bool IsConverter(PublishedPropertyType propertyType)
 {
     return(propertyType.PropertyEditorAlias.Equals("EnkelMedia.SeoVisualizer"));
 }
 public bool IsConverter(PublishedPropertyType propertyType)
 => propertyType.EditorAlias.InvariantEquals("Umbraco.Void");
Esempio n. 12
0
 public override Type GetGraphQLType(PublishedPropertyType propertyType)
 {
     return(typeof(GridGraphType));
 }
Esempio n. 13
0
 public override bool IsConverter(PublishedPropertyType propertyType)
 {
     return(propertyType.PropertyEditorAlias == Constants.PropertyEditors.GridAlias);
 }
Esempio n. 14
0
 /// <summary>
 /// Determines whether the property type varies by culture.
 /// </summary>
 public static bool VariesByCulture(this PublishedPropertyType propertyType) => propertyType.Variations.VariesByCulture();
Esempio n. 15
0
 public override bool IsConverter(PublishedPropertyType propertyType)
 {
     return(propertyType.PropertyEditorAlias.Equals("Imulus.UrlPicker"));
 }
 public object ConvertSourceToIntermediate(IPublishedElement owner, PublishedPropertyType propertyType, object source, bool preview)
 {
     SourceConverts++;
     return(int.TryParse(source as string, out int i) ? i : 0);
 }
Esempio n. 17
0
        public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
        {
            if (source == null)
            {
                return(new UrlPicker.Umbraco.Models.UrlPicker());
            }

            var sourceString = source.ToString();

            if (sourceString.DetectIsJson())
            {
                try
                {
                    var urlPicker = JsonConvert.DeserializeObject <Models.UrlPicker>(sourceString);

                    var helper = new UmbracoHelper(UmbracoContext.Current);

                    if (urlPicker.TypeData.ContentId != null)
                    {
                        urlPicker.TypeData.Content = helper.TypedContent(urlPicker.TypeData.ContentId);
                    }

                    if (urlPicker.TypeData.MediaId != null)
                    {
                        urlPicker.TypeData.Media = helper.TypedMedia(urlPicker.TypeData.MediaId);
                    }

                    switch (urlPicker.Type)
                    {
                    case Models.UrlPicker.UrlPickerTypes.Content:

                        if (urlPicker.TypeData.Content != null)
                        {
                            urlPicker.Url         = urlPicker.TypeData.Content.Url;
                            urlPicker.UrlAbsolute = urlPicker.TypeData.Content.UrlAbsolute();
                            urlPicker.Name        = (urlPicker.Meta.Title.IsNullOrWhiteSpace()) ? urlPicker.TypeData.Content.Name : urlPicker.Meta.Title;
                        }
                        break;

                    case Models.UrlPicker.UrlPickerTypes.Media:
                        if (urlPicker.TypeData.Media != null)
                        {
                            urlPicker.Url         = urlPicker.TypeData.Media.Url;
                            urlPicker.UrlAbsolute = urlPicker.TypeData.Media.Url();
                            urlPicker.Name        = (urlPicker.Meta.Title.IsNullOrWhiteSpace()) ? urlPicker.TypeData.Media.Name : urlPicker.Meta.Title;
                        }
                        break;

                    default:
                        urlPicker.Url         = urlPicker.TypeData.Url;
                        urlPicker.UrlAbsolute = urlPicker.TypeData.Url;
                        urlPicker.Name        = (urlPicker.Meta.Title.IsNullOrWhiteSpace()) ? urlPicker.TypeData.Url : urlPicker.Meta.Title;
                        break;
                    }

                    return(urlPicker);
                }
                catch (Exception ex)
                {
                    LogHelper.Error <UrlPickerValueConverter>(ex.Message, ex);
                    return(new UrlPicker.Umbraco.Models.UrlPicker());
                }
            }

            return(sourceString);
        }
 public object ConvertIntermediateToObject(IPublishedElement owner, PublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview)
 {
     InterConverts++;
     return((int)inter);
 }
Esempio n. 19
0
 public override object ConvertIntermediateToXPath(IPublishedElement owner, PublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview) {
     return null;
 }
 public object ConvertIntermediateToXPath(IPublishedElement owner, PublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview)
 => ((int)inter).ToString();
 /// <summary>
 /// The is converter.
 /// </summary>
 /// <param name="propertyType">
 /// The property type.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 public override bool IsConverter(PublishedPropertyType propertyType)
 {
     return(!string.IsNullOrEmpty(propertyType.PropertyEditorAlias) &&
            EditorAliases.Contains(propertyType.PropertyEditorAlias));
 }
Esempio n. 22
0
 public override bool IsConverter(PublishedPropertyType propertyType)
 {
 }
Esempio n. 23
0
 public override bool IsConverter(PublishedPropertyType propertyType)
 {
     return(propertyType.PropertyEditorAlias.Equals("Codery.TextCount"));
 }
Esempio n. 24
0
 public override Type GetPropertyValueType(PublishedPropertyType propertyType)
 {
 }
Esempio n. 25
0
        public override object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview)
        {
            var wrappedPropertyType = GetWrappedPropertyType(propertyType);

            return(wrappedPropertyType != null?wrappedPropertyType.ConvertSourceToObject(source, preview) : source);
        }
Esempio n. 26
0
 /// <summary>
 /// Specifies the alias of the property editor the converter acts upon.
 /// </summary>
 /// <param name="propertyType">Type of the property.</param>
 /// <returns></returns>
 public override bool IsConverter(PublishedPropertyType propertyType)
 {
     return(propertyType.PropertyEditorAlias == "Escc.Umbraco.PropertyEditors.RichTextPropertyEditor");
 }
Esempio n. 27
0
 public override object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview)
 {
     // source should come from ConvertSource and be a string (or null) already
     return(new HtmlString(source == null ? string.Empty : (string)source));
 }
 public bool IsConverter(PublishedPropertyType propertyType)
 {
     return(propertyType.PropertyEditorAlias.Equals(Constants.PropertyEditors.TextboxMultipleAlias));
 }
 /// <summary>
 /// Checks if this converter can convert the property editor and registers if it can.
 /// </summary>
 /// <param name="propertyType">
 /// The published property type.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 public bool IsConverter(PublishedPropertyType propertyType)
 {
     return(propertyType.PropertyEditorAlias.Equals("YouTube.Channel"));
 }
Esempio n. 30
0
 /// <summary>
 /// Determines whether the property type varies by segment.
 /// </summary>
 public static bool VariesBySegment(this PublishedPropertyType propertyType) => propertyType.Variations.VariesBySegment();