You can place the function in another file, but you need to use the
'file' parameter on your batch array. And there in lies a problem I see:
$batch = array(
'operations' => array(
array('mymodule_batch_task', array($var1, $var2)),
),
'finished' => 'mymodule_batch_finished',
'title' => t('batch process'),
'init_message' => t('starting.'),
'progress_message' => t('Processed @current out of @total.'),
'error_message' => t('encountered an error.'),
'file' => 'mymodule.admin.inc',
);
batch_set($batch);
It should be 'file' =>
drupal_get_path('module','mymodule').'/mymodule.admin.inc'
File needs the path on batches, unlike when you use it on a menu or theme item.
Jamie Holly
http://www.intoxination.net
http://www.hollyit.net
On 6/9/2010 6:29 PM, Ken Rickard wrote:
Undocumented, AFAIK, but your processing function has to be in the
main module file.
On Wed, Jun 9, 2010 at 4:55 PM, Jeff Greenberg<[email protected]> wrote:
> On 6/9/2010 4:17 PM, Randy Fay wrote:
>
> The batch_example.module in Examples project may be helpful.
>
> -Randy
>
> Thanks Randy, that project will be helpful in general. Unfortunately, the
> only difference I found was that in the example, batch_set is wrapped around
> the call to the function hooking batch, and in mine, the batch_set occurs in
> the hooking function. I changed it to be the same as the example (which has
> a comment in the block that sets up the batch example like mine that reads
> 'this doesn't seem to work') and same result...the batch status messages
> appear, but no processing seems to happen.
>
> Jeff
>