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.
API page: http://api.drupal.org/api/drupal/includes%21form.inc/function/batch_set/7
Enter a descriptive title (above) relating to batch_set, then describe the problem you have found:
The function argument is $batch_definition, but the @param doc does not match this (it says $batch).
Comment | File | Size | Author |
---|---|---|---|
#8 | drupal-form-inc-doc-1516934-8.patch | 4.85 KB | jmarkel |
#5 | drupal-form-inc-doc-1516934-5.patch | 4.87 KB | jmarkel |
#3 | drupal-form-inc-doc-1516934-3.patch | 4.48 KB | jmarkel |
#1 | drupal-form-inc-doc-1516934-1.patch | 4.76 KB | jmarkel |
Comments
Comment #1
jmarkel CreditAttribution: jmarkel commentedHere's a patch
Comment #2
jhodgdonI don't think this chunk belongs in the patch:
That is part of a code example, and the variable above there is definitely $batch, so that needs to stay as it was.
Regarding the other changes... If you want to bring the whole function up to coding standards (which is always nice!), you might also want to fix this bit:
It should probably say something more like:
An associative array defining the batch, with the following elements (all optional except where noted):
And then the list below should use (required) on that one required element.
Also, the paragraph at the end... If it is part of the @param, then there should not be a blank line before it. If it is not part of the @param, then it should be moved up to before the @param section of the docs.
Comment #3
jmarkel CreditAttribution: jmarkel commentedFirst bit - yeah, a bit of overzealousness on my part.
The rest - okay, try this one, which is significantly different. Things have been moved around (as suggested) and reworded for, I hope, a little more clarity and simplicity.
Note that I changed "Opens a new batch" to "Adds a new batch." "Opens" suggests that this function initiates a batch that already exists. This function, though, creates ( i.e. "Adds,") a new batch.
Comment #4
jhodgdonMuch better!
So... I know you didn't write these parts, but what do you think about the following ideas to further improve this documentation:
a) In the top paragraph, explaining about batches, it says:
Batch operations are added as new batch sets. Batch sets are used to provide clean code independence, ...
But really, I think the main reason we use batches is not to provide independence, but to process things that might take a while, right? That is not really explained anywhere, so it might be good to add something basic about the purpose of batches to that paragraph.
b) In the 'title' list item, it says: "Only safe strings should be passed." ... I always suggest this wording be changed whenever I see it in @param documentation. It should at least say "passed in", or better yet reword the whole list item to something like:
title: A safe, translated string to use as the title for the progress page. Defaults to t('Processing').
Other than those two suggestions, this looks good! Thanks!
Comment #5
jmarkel CreditAttribution: jmarkel commentedConsolidating your suggestions, jhodgdon.
I'm not completely confident of the new description, even if it is mostly cribbed from the 'Batch operations' documentation. I'm needing fresh eyes...
Comment #6
jhodgdonI think this looks great, thanks! I'll get it committed when I get back to my main computer (probably tomorrow),.
Comment #7
jhodgdonI committed this to 8.x. Needs port to 7.x.
Comment #8
jmarkel CreditAttribution: jmarkel commentedRe-rolled for 7.x
Comment #9
jhodgdonThis is now in 7.x too. Thanks!
And by the way, don't be alarmed about the test failure in #5. The test had stalled due to something weird on qa.drupal.org, and it finally got run after I had committed the patch, which is why it couldn't be applied.
Comment #10
jmarkel CreditAttribution: jmarkel commentedThanks. I'd wondered about the failed test - good to know it wasn't me :-)