Ejemplo n.º 1
0
        private IEnumerable <PropertyEditorBasic> MapAvailableEditors(IDataType source, MapperContext context)
        {
            var properties = _propertyEditors
                             .Where(x => !x.IsDeprecated || _contentSettings.ShowDeprecatedPropertyEditors || source.EditorAlias == x.Alias)
                             .OrderBy(x => x.Name);

            return(context.MapEnumerable <IDataEditor, PropertyEditorBasic>(properties));
        }
Ejemplo n.º 2
0
        public IDictionary <string, IEnumerable <DataTypeBasic> > GetGroupedPropertyEditors()
        {
            var datatypes = new List <DataTypeBasic>();
            var showDeprecatedPropertyEditors = _contentSettings.ShowDeprecatedPropertyEditors;

            var propertyEditors = _propertyEditorCollection
                                  .Where(x => x.IsDeprecated == false || showDeprecatedPropertyEditors);

            foreach (var propertyEditor in propertyEditors)
            {
                var hasPrevalues = propertyEditor.GetConfigurationEditor().Fields.Any();
                var basic        = _umbracoMapper.Map <DataTypeBasic>(propertyEditor);
                basic.HasPrevalues = hasPrevalues;
                datatypes.Add(basic);
            }

            var grouped = Enumerable.ToDictionary(datatypes
                                                  .GroupBy(x => x.Group.IsNullOrWhiteSpace() ? "" : x.Group.ToLower()), group => group.Key, group => group.OrderBy(d => d.Name).AsEnumerable());

            return(grouped);
        }