Skip to content

Conversation

@lookyman
Copy link

...like the rest of Nette\Forms\Controls.

Also with tests this time.

@lookyman
Copy link
Author

And apparently I am still bad at this. Dammit!

...hopefully
@Vrtak-CZ
Copy link
Contributor

please squash it into one commit :-)

@dg
Copy link
Member

dg commented Feb 21, 2014

Is it really needed? It makes control more complicated, just because there is an error in the annotation…

@hrach
Copy link
Contributor

hrach commented Mar 7, 2014

@dg the + is you can use easily your own macros, which call ->addAttributes() with parameter, which is by default empty array ([]). So this is BC break, my macros stopped working and I have to rewrite them to be getControl() return value aware.

@hrach hrach added 1-bug and removed 1-bug labels Mar 7, 2014
@fprochazka
Copy link
Contributor

I think it should be consistent and getControl() should always return Html object.

@dg
Copy link
Member

dg commented Mar 10, 2014

Primary: getControl() returned Html object because it had sense. Returning always Html object is little bit like cargo cult ;-) Creating $wrapper will lead to questions like „why other controls have no wrapper“? Because wrapper is unnecessary. Because returing Html when it has no sense is not unnecessary too.

So I understand @hrach point, but better is say: „Hey, do not rely on that getControl always returns Html, look at DefaultFormRenderer and fix your macros“ than change CheckboxList and support wrong design decision.

@mishak87
Copy link
Contributor

As @dg wrote this is of no value. Actual benefit would be if the markup was structured Html object so it can be walked and modified without parsing text to html and back.

It would be useful if I could extract all input[type=checkbox] in CheckboxList and wrap them in something else.

@fprochazka
Copy link
Contributor

@dg even consistency alone by itself is a pretty good argument. That fact that you wouldn't have to write ifs around every ->getControl() call, that you have to hack around right now, is a benefit that is a result of consistency.

For the same reason we shouldn't have boolean parameters that change result type of method call, and probably not even $need arguments (which, I admit, are sometimes handy).

The wrapper is useless here, the createInputList should have returned the Html object right away.

@dg
Copy link
Member

dg commented Jun 24, 2014

I agree that it is bad to write ifs around every getControl(). But are you doing it? In which case?

dg added a commit to nette/forms that referenced this pull request Jul 7, 2014
dg added a commit that referenced this pull request Jul 9, 2014
dg added a commit that referenced this pull request Jul 9, 2014
dg added a commit that referenced this pull request Aug 7, 2014
dg added a commit that referenced this pull request Aug 7, 2014
dg added a commit that referenced this pull request Aug 27, 2014
dg added a commit that referenced this pull request Aug 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants