Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 public int writeWithTreeBuilder(Context ctx, PhpTreeBuilder builder, int startIndex)
 {
     builder.AddContent(startIndex++, content);
     return(startIndex);
 }