Problem/Motivation
This issue is created as part of Part of meta issue #2072251: [meta] Modernize forms to use FormBase
Above issue was part of refactoring forms to use the FormBase class.
Now that #2059245: Add a FormBase class containing useful methods is also in in, we should look at old forms that have empty validateForm() methods, or still use Drupal::service() or t().
Fix any discrepancies if there are any.
The title looks good as it is similar to all the other issues created in meta issue #2072251: [meta] Modernize forms to use FormBase
Proposed resolution
Convert existing FormInterface forms to extend FormBase
Remove un-necessary validate functions.
Fix phpstan issues if any.
Quick search yields only a few test classes.
Remaining tasks
Needs review
User interface changes
N/A
API changes
N/A
Related Issues
| Comment | File | Size | Author |
|---|
Issue fork drupal-2077977
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 2077977-modernize-file-module-forms
changes, plain diff MR !12239
Comments
Comment #1
plopescFirst round...
Comment #4
pushpinderchauhan commentedUnable to apply above patch. Please review updated patch.
Comment #5
nielsonm commentedRerolled patch
Comment #6
xjmComment #7
alexpottNeeds a reroll.
Comment #24
mohit_aghera commentedComment #25
smustgrave commentedCan we update the title about what's being accomplished here.
Comment #26
mohit_aghera commentedComment #27
mohit_aghera commentedComment #28
smustgrave commentedThanks but think the actual title needs to updated.
looking in the file module there appear to be other test forms if we are just adding typehints?
Comment #29
mohit_aghera commentedI've updated the title.
I did a search and didn't found additional instances except one kernel test which we can't update
grep -r 'implements FormInterface' core/modules/file/testsComment #30
smustgrave commentedShould be fine then
Comment #31
xjmGreat cleanup! Saving credits.
There is something strange going on with the issue summary. I usually use the link to view the original issue summary to see if the original issue report was helpful, but it's missing. The original revision is also missing from the revision log and it appears the first revision is from @plopesc.
However, I'm going to err on the side of assuming the best and grant credit. (If it turns out to be a mistake we can fix it later.)
It appears that this will be @alexanansi's first issue credit in the crediting system. So, I did some git archaeology:
Looks like @alexanansi helped with these form cleanups back during D8 development, and this poor issue just happened to slip the net into the 2020s. :) Thanks @alexanansi, and thanks @mohit_aghera for reviving it!
Comment #32
xjmOops, missed one.
Comment #35
xjmCommitted to 11.x and 11.2.x, running PHPStan locally both times. I was tempted to backport it to 10.6.x and 10.5.x as a test cleanup, but maybe we should not be making baseline changes on the maintenance minor anymore. So marking fixed for now.
Thanks everyone!
Comment #37
fjgarlin commentedDisregard this comment. I’m trying to help debug an issue with credits.
Comment #38
xjmTrying again to save @alexanansi's credit, this time in a different browser.
Comment #39
xjmNow testing with JS disabled.
Comment #41
xjmThis time manually entering
alexanansiin the "Credit others" field.Comment #42
xjmCrediting @fjgarlin for helping me debug crediting. :)