Support from Acquia helps fund testing for Drupal Acquia logo

Comments

brianV’s picture

Status: Active » Needs review
FileSize
1.5 KB

You 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 than drupal_form_execute().

Here is a patch to rename drupal_execute() to drupal_execute_form(), as well as updating the only call to it in core:

aggregator_form_opml_submit in modules/aggregator/aggregator.admin.inc
    Process aggregator_form_opml form submissions. 
mr.baileys’s picture

Status: Needs review » Needs work
  1. There are some references to drupal_execute in the comments of form.inc (and possibly elsewhere) which should also be changed:
     * Forms can also be built and submitted programmatically without any user input
     * using the drupal_execute() function.
    
  2. If we are renaming, I'm not sure we should keep the "_execute" portion. What about drupal_form_submit? (Just my opinion though)

Back 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...

mr.baileys’s picture

Title: Move 'drupal_execute' to 'drupal_form_exceute' » Rename 'drupal_execute' to 'drupal_form_execute'
brianV’s picture

I 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()

brianV’s picture

Status: Needs work » Needs review

Forgot to reset to 'Needs Review'

mr.baileys’s picture

Title: Rename 'drupal_execute' to 'drupal_form_execute' » Rename 'drupal_execute'
Category: bug » task

Changing 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...

Status: Needs review » Needs work

The last submitted patch failed testing.

brianV’s picture

This 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.

brianV’s picture

Attaching a new patch with the updated test. I am leaving this at 'needs work' to prevent the testbot from testing (and failing) this patch.

brianV’s picture

and now, with attachment :)

Berdir’s picture

Status: Needs work » Needs review

Just updating the status...

brianV’s picture

Ah - 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 :)

Status: Needs review » Needs work

The last submitted patch failed testing.

brianV’s picture

Status: Needs work » Needs review
FileSize
17.55 KB

Re-rolling. The changes in #376129: Change getInfo() to a static method caused a minor conflict. Now fixed!

mr.baileys’s picture

Status: Needs review » Needs work
Issue tags: +DX (Developer Experience)

I 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)".

brianV’s picture

Status: Needs work » Needs review
FileSize
10.77 KB

Oops! That's what I get for doing this stuff late at night. Correct patch attached.

cburschka’s picture

Status: Needs review » Reviewed & tested by the community

This 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.

Dries’s picture

Status: Reviewed & tested by the community » Needs work

Much 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.

brianV’s picture

Status: Needs work » Fixed

This 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!

brianV’s picture

Just noting in here that I have written a coder review for this:

#448524: Coder test to catch drupal_execute() -> drupal_form_submit() rename

Status: Fixed » Closed (fixed)
Issue tags: -DX (Developer Experience)

Automatically closed -- issue fixed for 2 weeks with no activity.