You are here

function pagination_admin_settings_submit in Pagination (Node) 7

Same name and namespace in other branches
  1. 6 pagination.module \pagination_admin_settings_submit()

Submission handler for pagination_admin_settings().

File

./pagination.admin.inc, line 85

Code

function pagination_admin_settings_submit($form, &$form_state) {
  $pagination = $form_state['values']['pagination'];
  $style = $form_state['values']['style'];
  $showall = $form_state['values']['pagination_showall'];
  $ignore = $form_state['values']['pagination_ignore'];
  $header = $form_state['values']['pagination_header'];
  $list_type = $form_state['values']['pagination_list_type'];
  db_delete('pagination')
    ->execute();
  variable_set('pagination_showall', (int) $showall);
  variable_set('pagination_ignore', $ignore);
  variable_set('pagination_header', (int) $header);
  variable_set('pagination_list_type', $list_type);
  foreach ($pagination as $type => $value) {
    if ($value > 0) {
      $fields = array(
        'type' => $type,
        'paginate' => $value,
        'style' => $style[$type],
      );
      db_insert('pagination')
        ->fields($fields)
        ->execute();
    }
  }
  drupal_set_message(t('Pagination settings have been updated.'));
}