aggregator_categorize_items_submit

  1. drupal
    1. 6
    2. 8
    3. 7
Versions
6 – 8 aggregator_categorize_items_submit($form, &$form_state)

Process aggregator_categorize_items() form submissions.

Code

modules/aggregator/aggregator.pages.inc, line 210

<?php
function aggregator_categorize_items_submit($form, &$form_state) {
  if (!empty($form_state['values']['categories'])) {
    foreach ($form_state['values']['categories'] as $iid => $selection) {
      db_delete('aggregator_category_item')
        ->condition('iid', $iid)
        ->execute();
      $insert = db_insert('aggregator_category_item')->fields(array('iid', 'cid'));
      $has_values = FALSE;
      foreach ($selection as $cid) {
        if ($cid && $iid) {
          $has_values = TRUE;
          $insert->values(array(
            'iid' => $iid, 
            'cid' => $cid,
          ));
        }
      }
      if ($has_values) {
        $insert->execute();
      }
    }
  }
  drupal_set_message(t('The categories have been saved.'));
}
?>