Review main Abandoned

59027[FEATURE] Add "required" argument to checkbox and radio ViewHelper.

Eike Starkmann CR 0 V 0 Normal +96 −0 updated 01/06/22, 14:31

Commit message

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 5

Review log 4151

Show 2226 earlier messages
  1. Eike Starkmann uploaded patch set 1 12/04/18, 15:57

  2. TYPO3com voted on patch set 1 V +1 12/04/18, 16:10 Completed build in 12m 14s on Tue, 4 Dec, 05:10 PM Test Summary: 48552 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-30440

  3. Georg Ringer commented on patch set 1 CR -1 12/04/18, 19:17

    the rst belongs into 9.5.x and please then make it also for the radioVh to have it imo complete
  4. Eike Starkmann uploaded patch set 2 12/05/18, 10:56

  5. TYPO3com voted on patch set 2 V -1 12/05/18, 11:08 Completed build in 11m 59s on Wed, 5 Dec, 12:08 PM Test Summary: 48556 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-30463

  6. Eike Starkmann uploaded patch set 3 12/05/18, 11:11

  7. Eike Starkmann uploaded patch set 4 12/05/18, 11:20

  8. TYPO3com voted on patch set 3 V -1 12/05/18, 11:25 Completed build in 13m 43s on Wed, 5 Dec, 12:25 PM Test Summary: 48556 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-30464

  9. TYPO3com voted on patch set 4 V +1 12/05/18, 11:30 Completed build in 10m 39s on Wed, 5 Dec, 12:30 PM Test Summary: 48556 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-30465

  10. Raphael Graf commented on patch set 4 CR +1 12/05/18, 18:38

    If you're at it, you could fix the PasswordViewHelper too ;)

    Feature-87074-CheckboxAndRadioViewHelperSupportsRequiredArgument.rst:13

  11. Claus Due commented on patch set 4 CR -1 12/07/18, 15:31

    I would recommend not doing this, and in addition, stopping the practice of declaring these arguments as VH arguments. Reason being that providing these is already possible via `additionalAttributes` and that we're intentionally distorting how you normally provide boolean tag arguments in (X)HTML. If we implement this as booleans, you must pass `0` or `1` or `true` or `false` as argument value for an attribute that in (X)HTML requires a value of `required` or to not be specified at all. See also "removeEmptyAttributes" on TagBuilder.
  12. Claus Due commented on patch set 4 12/07/18, 15:37

    Further arguments against: * Every one of these arguments we declare, means that if we change this in the future, it's a breaking change. The same is not true if we stick to passing it through additionalAttributes. * The argument does not signal any server-side validation, it's purely about constructing the HTML tag and requires no special docs beyond referring to HTML specs.
  13. Richard Haeser commented on patch set 4 12/07/18, 15:43

    Although I don't want to demotivate new contributors, I think this is not the right way indeed. I agree on the arguments of Claus.
  14. Claus Due commented on patch set 4 12/07/18, 15:49

    Absolutely! The last thing I wanted to do was demotivate - Eike, I'm happy to talk about things we can do to improve working with these attributes so please feel free to catch me on Slack and have a talk about the use case you're facing ;)
  15. Raphael Graf commented on patch set 4 CR 0 12/07/18, 19:16

    IMO the boolean required attribute is extremely useful. Try writing an equivalent of the following with additionalAttributes only: <f:form.textfield required="{required}" additionalAttributes="{other:'true'} "/>
  16. Claus Due commented on patch set 4 12/07/18, 23:26

    @Raphael The syntax - which you can use right now without any patches - would be: <f:form.textfield additionalAttributes="{required: 'required'}" /> The main hurdle as I see it, is when you have to pass the value of "required" as a dynamic variable: <f:form.textfield additionalAttributes="{required: required}" /> In which case a FALSE value still renders the property, unless you use `ignoreEmptyAttributes()` on TagBuilder. There is also a further discussion to be had about forms in general, though it's moving slightly off topic. I believe it's becoming a bad idea to use ViewHelpers for each possible form field type - instead, I'd love to see a situation where we write HTML tags raw and have a VH that creates field names. This would mean the HMAC becomes opt-in and you are free to juggle default/prefilled values. In particular it makes for prettier GET-type requests than we are currently able to do. This is also why I'd be happy to take the discussion. I think there are so many different use cases that can be compounded into one feature such as allowing you to *not* use form ViewHelpers, e.g. providing a way to generate a valid form field name instead of an entire tag.
  17. Raphael Graf commented on patch set 4 12/08/18, 11:16

    > @Raphael > > The syntax - which you can use right now without any patches - > would be: > > <f:form.textfield additionalAttributes="{required: 'required'}" /> > > The main hurdle as I see it, is when you have to pass the value of > "required" as a dynamic variable: exactly, this is where the boolean attributes are helpful. > > <f:form.textfield additionalAttributes="{required: required}" /> > > In which case a FALSE value still renders the property, unless you > use `ignoreEmptyAttributes()` on TagBuilder. > > There is also a further discussion to be had about forms in > general, though it's moving slightly off topic. I believe it's > becoming a bad idea to use ViewHelpers for each possible form field > type - instead, I'd love to see a situation where we write HTML > tags raw and have a VH that creates field names. This would mean > the HMAC becomes opt-in and you are free to juggle > default/prefilled values. In particular it makes for prettier > GET-type requests than we are currently able to do. > > This is also why I'd be happy to take the discussion. I think there > are so many different use cases that can be compounded into one > feature such as allowing you to *not* use form ViewHelpers, e.g. > providing a way to generate a valid form field name instead of an > entire tag. Thanks for the explanation, removing the form-viewhelpers completely could be interesting.. But for now, the attributes of the form-viewhelpers should be consistent. (The current situation is a mess. Attributes like 'required', 'readonly' and 'disabled' should be boolean types, available on all form-viewhelpers where the apply.)
  18. Claus Due commented on patch set 4 12/08/18, 13:20

    @Raphael in a way you gave the argument for *not* doing it this way yourself in the previous comment. Although we might agree that the current situation is slightly inconsistent, I do not personally think that the right solution is to 1) add arguments which cause API differences, 2) add another case in every ViewHelper for every possible boolean argument, especially not when we actually have the ability to remove empty values for any tag attribute value through TagBuilder. If we are given a choice between changing our API to make it even more (X)HTML opinionated but make it accept values that aren't (X)HTML style, or retroactively addressing all installations that used `additionalAttributes` which is the only current solution - I think that's not really a choice. Then there is also the concern of compatibility. If we add this, we'd also need a check if this property was defined in `additionalAttributes` and had a correct value there; and we would run into chicken-egg problems about which of these should have priority: the old method would need priority if we're to remain compatible. I imagine a solution where a new feature toggle would be added, which means it's ON by default, that causes empty attribute values to be trimmed away. This would mean templates that used a condition and `additionalAttributes` can be cleaned up by simply removing code, no change to arguments or anything. And it would keep the API the same. You might even argue that such a thing is a bug fix that should go into LTS...
  19. Claus Due commented on patch set 4 12/08/18, 13:25

    See also https://github.com/TYPO3/Fluid/issues/288 which may be picked up at some point. This would allow passing arbitrary attributes to any tag-based ViewHelper without needing to declare as argument, and without needing to use `additionalAttributes`.
  20. Eike Starkmann commented on patch set 4 12/08/18, 13:34

    If we want to use additionalParameter, then we might have to change this as well: https://review.typo3.org/#/c/53303/
  21. Raphael Graf commented on patch set 4 12/08/18, 14:13

    @Claus Adding a global feature-toggle might be problematic: It would make it impossible for extensions to depend on a defined behavior.
  22. Claus Due commented on patch set 4 12/08/18, 16:53

    @Eike I missed that one back when it was merged - I think we would need to address that with a deprecation; and it also depends on the outcome of the RFC in Fluid that I linked to. I'll take all of this under thorough consideration! @Raphael that's a very good point. We could make this a toggle that works: * Per template file * Per extension key * Per extension and plugin name * Per extension, plugin name and controller * Globally With any one of those overriding the global behavior. One way this could be achieved is to store a globally accessible variable (e.g. ViewHelperVariableContainer) from within a new TemplateProcessor. The key is that TemplateProcessors have access to the RenderingContext and therefore the extension context and even Request if one is provided - so it could look for the toggle in the template, then in a list of predefined places, and finally globally which I suppose would then be a TYPO3 feature toggle like the others. Last piece of the puzzle might be to initialise the TagBuilder from within the AbstractForm(Field)ViewHelper to make it remove empty attributes based on this toggle that's stored for example in ViewHelperVariableContainer.
  23. Claus Due commented on patch set 4 12/08/18, 17:06

    Also considering somehow making this a Fluid-native feature. Let me chew on this bone for a while - I promise to come back with something ;)
  24. Tobi Kretschmann commented on patch set 4 04/10/19, 13:19

    > Patch Set 4: > > Also considering somehow making this a Fluid-native feature. Let me chew on this bone for a while - I promise to come back with something ;) Any update on this topic?
  25. Steffen Frese uploaded patch set 5 07/12/19, 13:27

  26. Steffen Frese commented on patch set 5 07/12/19, 13:29

    Feature-87074-CheckboxAndRadioViewHelperSupportsRequiredArgument.rst:13 Reply

    Done
  1. TYPO3com voted on patch set 5 V +1 07/12/19, 13:51 Completed build in 19m 23s on Fri, 12 Jul, 03:50 PM Test Summary: 47006 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-34970

  2. Jörg Bösche voted on patch set 5 CR +1 10/09/19, 13:39

  3. Daniel Siepmann uploaded patch set 6 10/09/19, 15:08

  4. TYPO3com voted on patch set 6 V -1 10/09/19, 15:20 Completed build in 11m 45s on Wed, 9 Oct, 03:20 PM Test Summary: 47727 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37189

  5. Raphael Graf commented on patch set 6 10/09/19, 15:37

    I think this attribute should be added to UploadViewHelper and PasswordViewHelper as well ..
  6. Claus Due commented on patch set 6 10/09/19, 19:17

    I still think we should be looking for a different solution instead of adding this here and in any further ViewHelpers; my arguments for why are in the comment history. For Fluid 3.0 I'm considering arbitrary passthrough of unregistered arguments to become tag attributes with "remove empty" switched on by default. Then you would handle the boolean XHTML attributes precisely like you would in a standard XHTML tag. The more convenience methods you add around tags in Fluid, the more you'll be removing later on. The use case is prevalent enough to merit a Fluid-native feature. Thus I advise against it.
  7. Daniel Siepmann uploaded patch set 7 10/24/19, 13:12

  8. TYPO3com voted on patch set 7 V -1 10/24/19, 13:14 Completed build in 31s on Thu, 24 Oct, 01:14 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37589

  9. Benni Mack rebased onto patch set 8 02/15/20, 09:36

  10. TYPO3com voted on patch set 8 V -1 02/15/20, 09:36 Completed build in 21s on Sat, 15 Feb, 09:36 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-100

  11. Georg Ringer voted on patch set 8 V +1 CR +1 02/15/20, 10:08

  12. Georg Ringer uploaded patch set 9 02/15/20, 15:32

  13. TYPO3com voted on patch set 9 V +1 02/15/20, 15:48 Completed build in 14m 59s on Sat, 15 Feb, 03:48 PM Test Summary: 71307 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-127

  14. Christian Eßl commented on patch set 9 CR -1 02/15/20, 16:17

    I get deprecation warnings from PHPUnit with these two tests: Using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringContainsString() or assertStringContainsStringIgnoringCase() instead. assertStringContainsString() should be used for these tests.
  15. Christian Eßl uploaded patch set 10 02/15/20, 16:26

  16. Christian Eßl voted on patch set 10 V +1 CR +1 02/15/20, 16:32

  17. TYPO3com voted on patch set 10 V +1 02/15/20, 16:39 Completed build in 13m 11s on Sat, 15 Feb, 04:39 PM Test Summary: 71307 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-128

  18. Georg Ringer voted on patch set 10 V +1 CR +1 02/15/20, 18:30

  19. Daniel Goerz commented on patch set 10 V -1 02/15/20, 18:40

    Björn needs to test the form framework with this patch, so I am blocking this for now
  20. Claus Due commented on patch set 10 CR -1 02/15/20, 18:44

    Blocking, based on my comment from Oct 6 that this is going in the wrong direction and is inconsistent with XHTML boolean properties. https://review.typo3.org/c/Packages/TYPO3.CMS/+/59027/10#message-01816d4987c5dc40e99a80c757fc4ce5e3e9d8ab
  21. Claus Due commented on patch set 10 02/15/20, 19:13

    See: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63264 This extremely tiny API can replace our current strategy of having dedicated ViewHelpers for every possible XHTML form field type and frees up the user to render form fields without the restrictions imposed on them from the current form field ViewHelpers. Also allows you to do things like register a bunch of field names that you intend to generate dynamically.
  22. Benni Mack commented on patch set 10 10/08/21, 08:05

    This change has been blocked for 1.5 years now, if no one steps up in the next few days, I will abandon the change for the time being, as it can be restored later-on
  23. Benni Mack wrote 11/29/21, 10:12

    Change destination moved from master to main
  24. Benni Mack updated the commit message in patch set 11 11/29/21, 13:36

  25. Benni Mack abandoned the change 01/06/22, 14:31

    abandoned due to lack of activity, can be restored later once somebody is willing to work on it