Exemplo n.º 1
0
        public static ArrayFieldItem CreateArrayField(this ArrayFieldOptions options)
        {
            ArrayFieldItem item = new ArrayFieldItem();

            ApplySchema(item, options);

            return(item);
        }
        public static TContentItem AddArrayFieldItem <TContentItem>(this TContentItem contentItem, string name, IContentSchema schema, Action <ArrayFieldItem> action)
            where TContentItem : IContentElement
        {
            ArrayFieldOptions options = schema.GetArrayFieldOptions(name);
            ArrayFieldItem    item    = options.CreateArrayField();

            action(item);

            return(AddArrayFieldItem(contentItem, name, item));
        }
        public static TContentItem AddArrayFieldItem <TContentItem>(this TContentItem contentItem, string name, ArrayFieldItem item)
            where TContentItem : IContentElement
        {
            ArrayField arrayField = contentItem.GetField <ArrayField>(name);

            arrayField.Items.Add(item);

            return(contentItem);
        }