1. It's not clear where the params for the finished callback batch_example_finished come from:
function batch_example_finished($success, $results, $operations) {
Op 1 has this:
// Store some result for post-processing in the finished callback.
$context['results'][] = $node->nid . ' : ' . check_plain($node->title);
Is that it? If so, there's also surely a bug in the code as op 2 doesn't put anything into the results key.
2. Where does the progress message get its placeholders from?
'progress_message' => t('Processed @current out of @total.'),
I can't see anything being put into $context that looks remotely like either of those!
Comments
Comment #1
BrockBoland commentedThe attached patch adds some explanatory comments for the 7.x branch. I'm not sure if Examples follows a backport policy like Drupal core, but I'll wait for some feedback on this one before backporting for 6.x.
Comment #2
joachim commentedLooks good.
Could batch_example_finished() get its @params documented too? I can't find anything about these at all.
Comment #3
mile23Nice addition!
Stylistically, it's better to have inline comments inside the function, rather than docblocks, so I converted it.
Committed: http://drupalcode.org/project/examples.git/commitdiff/4a89d812be35c63c33...
Thanks!
@joachim: You can see the @params being defined in _batch_process(), and they're listed in this change.