Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Comment | File | Size | Author |
---|---|---|---|
#30 | interdiff-2335673-21-26.txt | 789 bytes | ashutoshsngh |
#26 | drupal8-remove-drupal_process_form-2335673-26.patch | 5.62 KB | ashutoshsngh |
#21 | interdiff-18-21.txt | 2.97 KB | oenie |
#21 | drupal8-remove-drupal_process_form-2335673-21.patch | 6.39 KB | oenie |
#18 | drupal8-remove-drupal_process_form-2335673-18.patch | 6.44 KB | rudins |
Comments
Comment #1
ashutoshsngh CreditAttribution: ashutoshsngh commentedRemoved all occurences of drupal_process_form().
Comment #2
ashutoshsngh CreditAttribution: ashutoshsngh commentedComment #3
tim.plunkettGreat! Can you also please remove the function?
Comment #4
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedFunction also removed as mentioned in #3.
Comment #5
tim.plunkettThis will conflict (only slightly) with the very large #2335659: Remove FormState ArrayAccess usage from core, so postponing for now. Otherwise this would be RTBC.
Comment #6
tim.plunkettThe other issue went in, this can be rerolled.
Comment #7
ashutoshsngh CreditAttribution: ashutoshsngh commentedPatch rerolled.
Comment #10
oenie CreditAttribution: oenie commentedI think this missed the RTBC tag after the reroll.
Comment #11
alexpottWe should inject the form builder into these two classes.
Comment #12
oenie CreditAttribution: oenie commentedMy first real take on dependency injection in D8. Try me :)
Comment #13
legolasboComment #14
skipyT CreditAttribution: skipyT commentedI like this solution, injecting the formBuilder into the constructor, but in #2355179 we didn't do it for form_get_cache. we should be consequent I think
we have 2 times the \Drupal::formBuilder called here, why we don't extract it into a variable?
Comment #15
oenie CreditAttribution: oenie commentedSo what you're saying is that:
1) I need to remove the injection again and that change needs to move to a new issue (as in #2355179)
2) Extract the formbuilder into a variable
I'm not really fond of retracing my steps, but i suppose splitting up the patch shouldn't be that difficult.
I suppose the new issue should wait till this one (once changed) goes in ...
Comment #16
tim.plunkettJust because #2355179: Remove usage of form_get_cache() and form_set_cache() did it incorrectly doesn't mean this issue should. Please use injection.
#14.2 is just
$form_builder = \Drupal::formBuilder();
above the first usage, and then $form_builder->processForm when its needed.Comment #17
oenie CreditAttribution: oenie commentedI'm noticing a bunch of \Drupal::formBuilder() statements in the /core/modules/system/src/Tests/Form/FormTest.php file, in different methods.
Are you suggesting, tim.plunkett, that all of these should be replaced by just a local variable ? Or did you only mean to do this when the variable is used multiple times in the same function ?
I'm assuming that in this case a class-wide formbuilder variable that is initialized in the setup method of the test would be the cleanest way to go. 5 extra lines just extracting into a local variable sounds like nonsense to me :)
Right ?
Comment #18
rudins CreditAttribution: rudins commentedSo, here is patch for latest D8 code version.
Comment #19
rudins CreditAttribution: rudins commentedComment #20
oenie CreditAttribution: oenie commentedrudins, i appreciate the gesture but i was still waiting for some comment on the dependency injection.
You removed only part of it, yet as timplunkett mentioned in #16, dependency injection is to be preferred.
Also, i noticed a few unsused 'use' statements.
I'm uploading a new patch and interdiff in a minute
These use statements aren't needed, the dependency injection is happening in the parent class FormAjaxController.
As timplunkett mentioned in #16, dependency injection is preferred. You left in the added code for the form_builder to inject, but then removed the usage of the variable.
Comment #21
oenie CreditAttribution: oenie commentedI've updated the patch, and patched some newly added \Drupal->formbuilder() call while i was at it.
After speaking to timplunkett, i'm moving the replacement of the other mentioned \Drupal::formbuilder() calls by a class-variable in the test classes to a new issue. I'll link it here (as it will be depending on this patch to go in first).
Comment #22
oenie CreditAttribution: oenie commentedI moved the refactoring of the \Drupal::formBuilder() calls into issue #2362699: Replace multiple calls to \Drupal::formBuilder() in the Test classes
Comment #24
rpayanmLook fine for me and no occurrence of drupal_process_form().
Comment #25
alexpottPlus don't remove the function in the same issue that removes all the usages.
Also can we attach the correct CR to this issue.
Comment #26
ashutoshsngh CreditAttribution: ashutoshsngh commentedPatch rerolled
Comment #27
ashutoshsngh CreditAttribution: ashutoshsngh commentedPatch rerolled
Comment #28
ianthomas_uk#25 has been addressed, patch is otherwise unchanged.
Comment #29
rpayanm@ashutoshsngh interdiff please.
CR referenced.
Comment #30
ashutoshsngh CreditAttribution: ashutoshsngh commentedInterdiff attached.
Comment #31
alexpottThis issue is a prioritized change (removing deprecated code usage) as per https://www.drupal.org/core/beta-changes and it's benefits outweigh any disruption. Committed 2ec3fbc and pushed to 8.0.x. Thanks!