/// <summary> /// Creates a collection of components representing this form item. /// This can be used to display a form item without a <see cref="FormItemList"/>. /// </summary> public IReadOnlyCollection <FlowComponent> ToComponentCollection(bool omitLabel = false) => new FlowIdContainer( new DisplayableElement( context => new DisplayableElementData( Setup.DisplaySetup, () => ListErrorDisplayStyle.GetErrorFocusableElementLocalData(context, "div", ErrorSourceSet, null), classes: itemClass, children: (!label.Any() || omitLabel ? Enumerable.Empty <FlowComponent>() : new GenericPhrasingContainer(label, classes: labelClass).ToCollection <PhrasingComponent>().Append(new LineBreak())) .Append(new GenericFlowContainer(content, classes: contentClass)) .Concat(getErrorContainer()) .Materialize())).ToCollection(), updateRegionSets: Setup.UpdateRegionSets).ToCollection();
private DisplayableElementLocalData getErrorFocusableElementLocalData( ElementContext context, string elementName, IReadOnlyCollection <ElementAttribute> attributes) => ListErrorDisplayStyle.GetErrorFocusableElementLocalData(context, elementName, ErrorSourceSet, attributes);