YiiBooster icon indicating copy to clipboard operation
YiiBooster copied to clipboard

Advice on adding new input widgets to and/or extending TbActiveForm

Open motin opened this issue 11 years ago • 2 comments

We'd like to add more input widgets to TbActiveForm. Doing this be extending the relevant classes is problematic since TbActiveForm, TbInput, TbInputHorizontal, TbInputVertical extend each other.

We figure that this problem was the reason that you decided to maintain your own fork of YiiBootstrap to begin with (instead of creating an extension library that would extend these classes with YbActiveForm etc).

What is your advice for those, like us, cannot rely on sending all our widget's as PR's to be included in YiiBooster, but do not want to create yet another incompatible fork of YiiBootstrap/YiiBooster (something like YiiBoosterBooster)?

Have you for instance considered switching over to YiiStrap+YiiWheels which has a much cleaner architecture without for instance the TbInput[Layout] classes? Currently, these seems to mostly be copy-pasted and slightly modified code, with the main difference between it's methods is wrapping of the elements in <div class="controls"/>, surely this is not a good design to keep moving forward?

motin avatar Jul 10 '13 00:07 motin

Well, @motin if you're referring directly to me as a maintainer of the YiiBooster then I'm more interested in fixing the bugs in codebase and writing a rock-solid documentation for it than extending it by adding any more features, because the internal state of this project is very, very bad.

Of course, the mechanics of TbActiveForm is an abomination. I understand, though, why Antonio did things the way he did, because I was there and saw for myself under what pressure he was.

I neither like nor think that YiiStrap arch is anymore better than YiiBooster's, because Antonio and Cris (and probably a lot of other contributors, too) follow the style of Yii's own codebase very closely, which means astoundingly huge monster classes, monster methods, no real unit tests and a code&fix strategy overall. I'm not content with it.

If no one will propose a PR with a backwards-compatible rewrite of TbActiveForm API, covered by tests, form mechanics will stay the same for at least until winter. Unfortunately, I alone have very limited resources to spend on refactoring, fixing and documenting existing features of YiiBooster. It's not so small system, with 71 widgets and an array of helper classes. Do not expect Grand Redesign or totally new features from me for now.

hijarian avatar Jul 17 '13 18:07 hijarian

Answering your question, btw.

I know that @gureedo is working on total rewrite of TbActiveForm and his main concern is precisely the extendability of it. Related ticket is #629. You can follow that ticket (or maybe even contact the author) if you're interested.

Was very interested after you mentioned "cannot rely on sending all our widgets as PRs", which suggests that you out there have a pack of new widgets to be included. ;)

By the way, as far as I understand the YiiBooster architecture, there's nothing preventing you from adding new widgets to the codebase (except the current policy about new features). You don't have to add support for making this widget into method on TbActiveForm. You can fake all relevant HTML wrappers manually or even better - write the helper method in your own codebase for it, and be done with it. There is no special need in making the same amount of work as in amazing TbDateTimePicker PR: #642 (it only lacks tests, to my taste).

hijarian avatar Sep 02 '13 07:09 hijarian