Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor form container #217

Closed
wants to merge 1 commit into from
Closed

Conversation

juzna
Copy link
Contributor

@juzna juzna commented Mar 19, 2011

Refactored Nette\Forms\FormContainer::getValues and ::setValues to use recursion instead of ugly recursive iterators. This code is much more straightforward in what it should do plus it allows extension (see below). Plus, all tests pass on it (so it shouldn't break anything)

See discussion on http://forum.nette.org/cs/6964-prilisna-slozitost-formcontainer-setvalues-getvalues

It also allows possible extension on your specific named containers: you can implement a class extending FormContainer and by overriding setValue + getValue methods, you can do absolutely whatever you want (like creating dynamic number of elements etc.) Serialization and deserialization is completely in your hands. This also goes very well with https://github.com/Foowie/DynamicFormContainer addon which when impelemting setValue + getValue can work much better than it's working now (pull request for that addon will be provided soon)

@juzna
Copy link
Contributor Author

juzna commented Mar 19, 2011

As I proposed before: Patch for DynamicFormContainer which makes its default values working can be very easy now: juzna/DynamicFormContainer@6cccc2d Take this as one example of possible extension to forms which will be available now.

@dg
Copy link
Member

dg commented Mar 21, 2011

Merged

@dg dg closed this Mar 21, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants