public int writeWithTreeBuilder(Context ctx, PhpTreeBuilder builder, int startIndex) { foreach (var item in attributes) { if (!item.Key.IsString) { builder.AddAttribute(startIndex++, item.Value.ToString(), null); } else { builder.AddAttribute(startIndex++, item.Key.String, item.Value.ToString()); } } if (styles != null) { builder.AddAttribute(startIndex++, "style", styles.ToString()); } if (classes != null) { builder.AddAttribute(startIndex++, "class", classes.ToString()); } foreach (var item in events) { item.Value.Invoke(ctx, startIndex++, PhpValue.FromClass(builder)); } return(startIndex); }
public int writeWithTreeBuilder(Context ctx, PhpTreeBuilder builder, int startIndex) { builder.OpenElement(startIndex++, name); startIndex = attributes.writeWithTreeBuilder(ctx, builder, startIndex); content.ForEach(x => startIndex = x.writeWithTreeBuilder(ctx, builder, startIndex)); builder.CloseElement(); return(startIndex); }
public int writeWithTreeBuilder(Context ctx, PhpTreeBuilder builder, int startIndex) { builder.AddContent(startIndex++, content); return(startIndex); }