Same name and namespace in other branches
  1. 4.7.x modules/aggregator.module \aggregator_form_category_submit()
  2. 6.x modules/aggregator/aggregator.admin.inc \aggregator_form_category_submit()
  3. 7.x modules/aggregator/aggregator.admin.inc \aggregator_form_category_submit()

Process aggregator_form_category form submissions. @todo Add delete confirmation dialog.

File

modules/aggregator/aggregator.module, line 362
Used to aggregate syndicated content (RSS, RDF, and Atom).

Code

function aggregator_form_category_submit($form_id, $form_values) {
  if ($form_values['op'] == t('Delete')) {
    $title = $form_values['title'];

    // Unset the title:
    unset($form_values['title']);
  }
  aggregator_save_category($form_values);
  menu_rebuild();
  if (isset($form_values['cid'])) {
    if (isset($form_values['title'])) {
      drupal_set_message(t('The category %category has been updated.', array(
        '%category' => $form_values['title'],
      )));
      if (arg(0) == 'admin') {
        return 'admin/content/aggregator/';
      }
      else {
        return 'aggregator/categories/' . $form_values['cid'];
      }
    }
    else {
      watchdog('aggregator', t('Category %category deleted.', array(
        '%category' => $title,
      )));
      drupal_set_message(t('The category %category has been deleted.', array(
        '%category' => $title,
      )));
      if (arg(0) == 'admin') {
        return 'admin/content/aggregator/';
      }
      else {
        return 'aggregator/categories/';
      }
    }
  }
  else {
    watchdog('aggregator', t('Category %category added.', array(
      '%category' => $form_values['title'],
    )), WATCHDOG_NOTICE, l(t('view'), 'admin/content/aggregator'));
    drupal_set_message(t('The category %category has been added.', array(
      '%category' => $form_values['title'],
    )));
  }
}