function aggregator_categorize_items_submit

Form submission handler for aggregator_categorize_items().

1 string reference to 'aggregator_categorize_items_submit'
aggregator_categorize_items in modules/aggregator/aggregator.pages.inc
Form constructor to build the page list form.

File

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

Code

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.'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.