public ContentBlocksDataValueEditor( IContentTypeService contentTypeService, IDataTypeService dataTypeService, PropertyEditorCollection propertyEditors) : base() { _dataTypeService = dataTypeService; _elementTypes = new Lazy <Dictionary <Guid, IContentType> >(() => contentTypeService.GetAllElementTypes().ToDictionary(x => x.Key)); _propertyEditors = propertyEditors; }
public ContentBlocksConfigurationEditor(IContentService contentService, IContentTypeService contentTypeService) : base() { // NOTE: Gets all the elementTypes and blueprints upfront, rather than several hits inside the loop. _elementTypes = contentTypeService.GetAllElementTypes().ToDictionary(x => x.Key); _elementBlueprints = new Lazy <ILookup <int, IContent> >(() => contentService.GetBlueprintsForContentTypes(_elementTypes.Values.Select(x => x.Id).ToArray()).ToLookup(x => x.ContentTypeId)); Fields.Add(new ContentBlocksTypesConfigurationField(_elementTypes.Values, new ConfigurationEditorService())); Fields.Add(new ContentBlocksDisplayModeConfigurationField()); Fields.Add(new EnableFilterConfigurationField()); Fields.Add(new MaxItemsConfigurationField()); Fields.Add(new DisableSortingConfigurationField()); Fields.Add(new HideLabelConfigurationField()); }
public IEnumerable <object> GetAll() { return(_contentTypeService .GetAllElementTypes() .OrderBy(x => x.SortOrder) .Select(x => new { id = x.Id, key = x.Key, name = x.Name, description = x.Description, alias = x.Alias, icon = x.Icon })); }
public ContentBlocksConfigurationEditor( IContentService contentService, IContentTypeService contentTypeService, ConfigurationEditorUtility utility) : base() { _utility = utility; // NOTE: Gets all the elementTypes and blueprints upfront, rather than several hits inside the loop. _elementTypes = contentTypeService.GetAllElementTypes().ToDictionary(x => x.Key); _elementBlueprints = new Lazy <ILookup <int, IContent> >(() => contentService.GetBlueprintsForContentTypes(_elementTypes.Values.Select(x => x.Id).ToArray()).ToLookup(x => x.ContentTypeId)); var displayModes = utility.GetConfigurationEditorModels <IContentBlocksDisplayMode>(); // NOTE: Sets the default display mode to be the Blocks. var defaultDisplayMode = displayModes.FirstOrDefault(x => x.Key.InvariantEquals(typeof(BlocksDisplayMode).GetFullNameWithAssembly())); if (defaultDisplayMode != null) { DefaultConfiguration.Add(DisplayMode, new[] { new { key = defaultDisplayMode.Key, value = defaultDisplayMode.DefaultValues } }); } Fields.Add(new ConfigurationField { Key = DisplayMode, Name = "Display mode", Description = "Select and configure how to display the blocks in the editor.", View = IOHelper.ResolveUrl(ConfigurationEditorDataEditor.DataEditorViewPath), Config = new Dictionary <string, object>() { { Constants.Conventions.ConfigurationFieldAliases.AddButtonLabelKey, "contentment_configureDisplayMode" }, { Constants.Conventions.ConfigurationFieldAliases.Items, displayModes }, { MaxItemsConfigurationField.MaxItems, 1 }, { DisableSortingConfigurationField.DisableSorting, Constants.Values.True }, { Constants.Conventions.ConfigurationFieldAliases.OverlayView, IOHelper.ResolveUrl(ConfigurationEditorDataEditor.DataEditorOverlayViewPath) }, { EnableDevModeConfigurationField.EnableDevMode, Constants.Values.True }, } }); Fields.Add(new ContentBlocksTypesConfigurationField(_elementTypes.Values)); Fields.Add(new EnableFilterConfigurationField()); Fields.Add(new MaxItemsConfigurationField()); Fields.Add(new DisableSortingConfigurationField()); Fields.Add(new EnableDevModeConfigurationField()); }
public IEnumerable <object> GetContentTypes() => _contentTypeService .GetAllElementTypes() .OrderBy(x => x.SortOrder) .Select(x => new