Пример #1
0
        protected override DriverResult Display(ContentPart part, OptionSetField field, string displayType, dynamic shapeHelper)
        {
            return(ContentShape("Fields_OptionSetField", GetDifferentiator(field, part),
                                () => {
                var settings = field.PartFieldDefinition.Settings.GetModel <OptionSetFieldSettings>();
                var optionItems = _optionSetService.GetOptionItemsForContentItem(part.ContentItem.Id, field.Name).ToList();
                var optionSet = _optionSetService.GetOptionSet(settings.OptionSetId);

                return shapeHelper.Fields_OptionSetField(
                    ContentField: field,
                    OptionItems: optionItems,
                    Settings: settings,
                    OptionSet: optionSet);
            }));
        }
Пример #2
0
        public override object GetValue(ContentItem contentItem, ContentField field)
        {
            var optionItems = _optionSetService.GetOptionItemsForContentItem(contentItem.Id, field.Name).ToList();

            var value = string.Join(", ", optionItems.Select(t => t.Name).ToArray());

            return(value);
        }