Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
forms system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
27 Nov 2013 at 03:16 UTC
Updated:
29 Jul 2014 at 23:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
amateescu commentedWhat's the reason for "hiding" the method name (setErrorByName())? Are we not proud of it or something? :)
Comment #2
dawehnerI like the fact that this potentially makes it more decoupled.
Comment #3
tim.plunkettI think the difference between FormBuilder::setError() and FormBuilder::setErrorByName() is confusing, and we shouldn't expose that to FormBase. We can pick a good name, and then if we ever rename or refactor or remove the FormBuilder ones, we don't have to update the names throughout.
Rerolled.
Comment #4
h3rj4n commentedWhy don't you use the dependency injection? I created a patch that does this after rerolling your patch.
Added a interdiff of the merge conflicts and a interdiff with the changes of the dependency injection.
Comment #6
tim.plunkettBecause that won't work. See your failures. We have to follow the pattern of the setters/getters.
Comment #8
tim.plunkettThis didn't need a reroll at all. Please review the patch in #3.
Comment #9
tim.plunkettNow it needed a reroll. Aggregator categories were removed.
Comment #10
jibranUmm is it correct?
Comment #11
tim.plunkettYes, when dealing with fieldsets the #parents are a bit different. There are many more usages of form_set_error (the style with the string) than form_error (the style with the form element), and so I chose the string-based one. Also, you must have access to the $form and $form_state to use form_error, whereas the string-based you only need $form_state.
I manually tested all of the fieldset based ones, as well.
Comment #12
jibranIt can also be NULL
Perhaps little more description explaining that what can be used as name.
Comment #13
tim.plunkett1) PHP casts NULL to an empty string when used as an array indices, so let's just always use a string.
2) I think the @see is enough here.
Comment #14
jibranThanks for the fixes. It is a simple patch nothing else to complain so RTBC.
Comment #15
alexpottCommitted 560e5af and pushed to 8.x. Thanks!
Comment #16
tim.plunkettComment #17
jonreid commentedSummary
Before
After
Comment #18
jonreid commentedCreated change notice comment.
Comment #19
star-szrThanks @jonreid! In the code samples I'm not sure if having the class declaration is useful, but I would definitely show that the code is in the validateForm method, and perhaps seek out a shorter example.
Comment #20
xjmThanks @jonreid and @Cottser! Tagging "Missing change record", as completing the change record updates here blocks a beta: #2083415: [META] Write up all outstanding change notices before release We can even use the new change record draft feature to iterate on it. :)
Comment #21
star-szrYay! Created my first draft change record: https://drupal.org/node/2186135
Revisions welcome, publish it when it's good to go :)
Thanks again @jonreid!
Comment #22
xjmLooks great to me! Published.
Comment #23
xjm