You are here

function pathauto_entity_bulk_update_form_submit in Pathauto Entity 7

Form submit handler for path alias bulk update form.

Overrides Pathauto's pathauto_batch_update_form_submit() handler to allow us to pass $settings data to batch operations.

See also

pathauto_entity_bulk_update_form()

pathauto_bulk_update_form_submit()

pathauto_entity_bulk_update_batch_start()

pathauto_entity_bulk_update_batch_process()

pathauto_entity_bulk_update_batch_finished()

File

includes/pathauto_entity.admin.inc, line 131
Pathauto Entity admin callback implementations.

Code

function pathauto_entity_bulk_update_form_submit($form, &$form_state) {
  $batch = array(
    'title' => t('Bulk updating URL aliases'),
    'operations' => array(
      array(
        'pathauto_entity_bulk_update_batch_start',
        array(),
      ),
    ),
    'finished' => 'pathauto_entity_bulk_update_batch_finished',
    'file' => drupal_get_path('module', 'pathauto_entity') . '/includes/pathauto_entity.batch.inc',
  );
  foreach ($form_state['values']['update'] as $key => $value) {
    if (!empty($value)) {
      $callback = $form['#update_callbacks'][$key]->batch_update_callback;
      $settings = $form['#update_callbacks'][$key];
      if (!empty($settings->batch_file)) {
        $batch['operations'][] = array(
          'pathauto_entity_bulk_update_batch_process',
          array(
            $callback,
            $settings,
          ),
        );
      }
      else {
        $batch['operations'][] = array(
          $callback,
          array(),
        );
      }
    }
  }
  batch_set($batch);
}