Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create drupal Batch Operation on Custom Form
    primarykey
    data
    text
    <p>I am learing batch operations api. i have tried to create a batch operation using a form here is my hook_form</p> <pre><code>function batch_form_get_form($form, &amp;$form_state){ $form = array(); $form['select'] = array( '#title' =&gt; 'Select', '#type' =&gt;'select', '#options' =&gt; array( 'batch1' =&gt; 'Batch 1', 'batch2' =&gt; 'Batch 2', ), ); $form['submit'] = array( '#type' =&gt; 'submit', '#value' =&gt; 'Submit' ); return $form; } </code></pre> <p>here is my form submit function </p> <pre><code>function batch_form_get_form_submit($form,&amp;$form_state){ $function = 'batch_process_form'; $_SESSION['http_request_count'] =0; $batch = $function; batch_set($batch); dsm ($function); } </code></pre> <p>here is my batch process function which i used on batch_set function</p> <pre><code>function batch_process_form(){ for($i=0; $i&lt;10; $i++){ $operations[] = array('batch_operation_result',array($i)); } $title = "Batch Started"; $init_message = "Initialing Batch"; $progress_message = "Work in Progress"; $batch = array( 'operations' =&gt; $operations, 'title' =&gt; $title, 'init_message' =&gt; $init_message, 'progress_message' =&gt; $progress_message, ); return $batch; } </code></pre> <p>when i tried to run the batch i got the following error</p> <pre><code>Fatal error: Unsupported operand types in /home/dina/static/d7/includes/form.inc on line 4396 </code></pre> <p>on the line no 4396 of form.inc</p> <pre><code> $batch_set = $init + $batch_definition + $defaults; </code></pre> <p>i don't no what i am missing</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload