Tiny tutorial for programming SFI?
Hi Yury, a very short manual would probably be something like 1. Create a subclass of SFFormInput, e.g. call it MyNewInputClass 2. Register your new input like this: $sfgFormPrinter->registerInputType( 'MyNewInputClass' );
There are a few things to be aware of (e.g. the expected name attribute of the html input elements), but this is the basic idea. I think the SFI code improved a lot lately, so it should be possible to follow what is done there. E.g. have a look at the timepicker code. And if you come up with an input, that could be useful for others, consider contributing it!
I have almost finished with my FormsInput for picking multiple elements so I'll be able to expand your instructions a little bit. I still don't understand some things, would you mind to help me with them?
- the name attribute of the form input sometimes have brackets like in it like this: input3.
- On the other hand sometimes we add an additional hidden element like
Html::hidden($name . '[is_list]', 1)
- And thirdly we have the method canHandleLists() to override.
It seems that all three thing are indicating that the form input can handle lists, but it's pretty weird to see three different pieces of code trying to say the same thing. :-)