Closed (outdated)
Project:
Drupal core
Version:
main
Component:
forms system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
25 May 2015 at 18:50 UTC
Updated:
30 Sep 2026 at 15:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
xanoComment #2
jhodgdonUm, second line should be indented I think?
Comment #3
xanoDone. Thanks!
Comment #4
jhodgdonThanks! Tthe formatting looks good to me now.
But I cannot comment on whether the methods should be deprecated, so I think I'll leave the RTBC to someone else... and this is probably not really just Documentation: deprecating a function is not really a docs issue.
Comment #5
tim.plunkettFormBase is more than just a collection of setters/getters.
For example, it is very convenient to provide an empty validate(), to use DependencySerializationTrait (not fun to debug if you forget that!), and the protected getters are useful even if you use constructor-based DI.
I think it's reasonable to individually deprecate all of the *setters*, but there is nothing wrong with the getters or the rest of the class as a whole.
Comment #6
mile23There are some funky design decisions with
FormBase, which make it useful but also break the container injection pattern. It declares that it implementsContainerInjectionInterfacebut then doesn't really, because it'screate()method just returnsnew static()So really what should happen is that we should make a better version of the
FormBasewhich usescreate()to inject the dependencies it provides, especially over using\Drupalas a shortcut. Then getters and setters would be deprecated.That's outside the scope here, so let's make a new issue. :-)
Setting this issue as postponed on whatever's decided in #2674508: Improve docs for how to properly add container injection into a class that extends FormBase
Comment #10
mile23#2674508: Improve docs for how to properly add container injection into a class that extends FormBase is fixed. It went from INJECT ALL THE THINGS! to improve the docblock.
Comment #23
smustgrave commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #25
smustgrave commentedThink this can be closed as outdated. Summary isn't super clear what's the goal but don't see the setters/getters. I do see we now have AutowireTrait which idk is related but makes injecting the services easier. Going to close this one out, but if I'm wrong lets reopen.