You are here

function pathauto_admin_delete_submit in Pathauto 7

Same name and namespace in other branches
  1. 5.2 pathauto.module \pathauto_admin_delete_submit()
  2. 6.2 pathauto.admin.inc \pathauto_admin_delete_submit()
  3. 6 pathauto.admin.inc \pathauto_admin_delete_submit()

Process pathauto_admin_delete form submissions.

File

./pathauto.admin.inc, line 413
Admin page callbacks for the Pathauto module.

Code

function pathauto_admin_delete_submit($form, &$form_state) {
  foreach ($form_state['values'] as $key => $value) {
    if ($value) {
      if ($key === 'all_aliases') {
        db_delete('url_alias')
          ->execute();
        drupal_set_message(t('All of your path aliases have been deleted.'));
      }
      $objects = module_invoke_all('path_alias_types');
      if (array_key_exists($key, $objects)) {
        db_delete('url_alias')
          ->condition('source', db_like($key) . '%', 'LIKE')
          ->execute();
        drupal_set_message(t('All of your %type path aliases have been deleted.', array(
          '%type' => $objects[$key],
        )));
      }
    }
  }
  $form_state['redirect'] = 'admin/config/search/path/delete_bulk';
}