1 path.admin.inc path_bulk_update_form_generate_submit($form, &$form_state, $op = 'generate')

Submit handler for path alias bulk generate form.

See also

path_bulk_update_form()

path_bulk_update_form_rebuild_submit()

File

core/modules/path/path.admin.inc, line 777
Administrative page callbacks for the path module.

Code

function path_bulk_update_form_generate_submit($form, &$form_state, $op = 'generate') {
  $batch = array(
    'title' => t('Bulk updating URL aliases'),
    'operations' => array(
      array('path_bulk_update_batch_start', array()),
    ),
    'finished' => 'path_bulk_update_batch_finished',
    'file' => backdrop_get_path('module', 'path') . '/path.admin.inc',
  );

  foreach ($form_state['values']['update'] as $entity_types => $entities) {
    $choices = array();
    $entities = array_filter($entities);
    // Build an array of selected entity/bundle choices.
    foreach ($entities as $label => $choice) {
      $choices[$label] = $label;
    }
    if (!empty($choices)) {
      $path_info = $form['#update_callbacks'][$entity_types];
      $path_info['choices'] = empty($choices['base']) ? $choices : array();
      $path_info['op'] = $op;
      $callback = $path_info['batch update callback'];

      if (!empty($path_info['batch file'])) {
        $batch['operations'][] = array('path_bulk_update_batch_process', array($callback, $path_info));
      }
      else {
        $batch['operations'][] = array($callback, array());
      }
    }
  }

  batch_set($batch);
}