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.
Because it's deceiving.
Comment | File | Size | Author |
---|---|---|---|
#16 | rename_drupal_execute_rev4.patch | 10.77 KB | brianV |
#14 | database_system_cleanup-rev4.patch | 17.55 KB | brianV |
#10 | rename_drupal_execute_rev3.patch | 10.73 KB | brianV |
#4 | rename_drupal_execute_rev2.patch | 5.31 KB | brianV |
#1 | rename_drupal_execute.patch | 1.5 KB | brianV |
Comments
Comment #1
brianV CreditAttribution: brianV commentedYou are right - that is a rather ambiguous name for this function. I kind of like
drupal_execute_form()
as a new name - it seems to flow better thandrupal_form_execute()
.Here is a patch to rename
drupal_execute()
todrupal_execute_form()
, as well as updating the only call to it in core:Comment #2
mr.baileysBack to CNW for #1
Also, it's probably wise to report this change in the changelog, and the docs will need updating if this gets commited...
Comment #3
mr.baileysComment #4
brianV CreditAttribution: brianV commentedI agree that
drupal_form_submit()
is even better. We aren't executing this form - we are submitting it programatically. Of course, one could argue that we are executing the form validation and resulting actions...I've attached a new patch with all comments in core updated, and the rename changed to
drupal_form_submit()
Comment #5
brianV CreditAttribution: brianV commentedForgot to reset to 'Needs Review'
Comment #6
mr.baileysChanging category to task since this isn't really a bug.
Looks good at a first visual inspection and all tests pass.
I'm in favor of this change, but let's leave this set to "need review" so that some of the core maintainers and other community members can weigh in...
Comment #8
brianV CreditAttribution: brianV commentedThis is failing because a new test was written over the weekend that calls drupal_execute(). I will have to reroll a copy of this patch with the updated test. Until then, people will need to overlook the failed tests.
Comment #9
brianV CreditAttribution: brianV commentedAttaching a new patch with the updated test. I am leaving this at 'needs work' to prevent the testbot from testing (and failing) this patch.
Comment #10
brianV CreditAttribution: brianV commentedand now, with attachment :)
Comment #11
BerdirJust updating the status...
Comment #12
brianV CreditAttribution: brianV commentedAh - I was worrying that it wouldn't pass the test, since I renamed drupal_execute() and it is called in a newly added test.
I didn't realize that the bot would use the patched test :)
Comment #14
brianV CreditAttribution: brianV commentedRe-rolling. The changes in #376129: Change getInfo() to a static method caused a minor conflict. Now fixed!
Comment #15
mr.baileysI think you've got your patches mixed up ;) Can you attach the correct one?
Going through the change logs for form.inc, it looks like the function was originally called "drupal_execute_form", which was changed to "drupal_submit_form" in #39576: Replace execute with submit. Quickly scanning some of the issues and documentation, I think there used to be 3 functions involved in programmatically submitting a form. "Drupal_submit_form" was then replaced/superseded by "drupal_execute" in #80470: FormAPI: better handling of programmatic submission.
Given the history of this function, it would be good to have some FAPI experts comment on this change. Also tagging this as "DX (Developer Experience)".
Comment #16
brianV CreditAttribution: brianV commentedOops! That's what I get for doing this stuff late at night. Correct patch attached.
Comment #17
cburschkaThis looks good.
No code style issues, no remaining occurrences of drupal_execute using grep, and it looks like the tests work.
A maintainer still needs to decide if the function should be renamed at all, but this patch won't get any readier.
Comment #18
Dries CreditAttribution: Dries commentedMuch better name, IMO. Committed to CVS HEAD. Thanks!
I'm marking this 'code needs work' because the upgrade documentation needs to be updated. Please mark as 'fixed' after the documentation was updated.
Comment #19
brianV CreditAttribution: brianV commentedThis change has been documented in:
http://drupal.org/node/224333
http://drupal.org/node/394070
If there is anywhere else I should document it, let me know!
Comment #20
brianV CreditAttribution: brianV commentedJust noting in here that I have written a coder review for this:
#448524: Coder test to catch drupal_execute() -> drupal_form_submit() rename