Here are some of my ideas. They are changing frequently.
Fill free to add yours.
Probably with some kind of data_source classes to which will have same interface so that they could be easily rendered. For now I think that this should be implemented as separate lib.
Solution for adding display attributes. I think that best will be in form:
$attribute->required->style = "color: red;"; $attribute->normal->style = "color: blue;"; $attribute->error->class = "error";
This solution is implemented in kodform4.
Should have support for xforms but as separate classes or member function ( $form→displayX() ).