function pagination_admin_settings_submit in Pagination (Node) 6
Same name and namespace in other branches
- 7 pagination.admin.inc \pagination_admin_settings_submit()
@desc Pagination settings submission
File
- ./
pagination.module, line 189 - pagination.module @desc Allow for arbitrary nodes to be paginated. administrators can set which nodes they wish to paginate, and the length of content required to split a node into pages. Alternatively, content creators can set manual break points…
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'];
$onebased = $form_state['values']['pagination_onebased'];
$header = $form_state['values']['pagination_header'];
$listtype = $form_state['values']['pagination_list_type'];
$showhelp = $form_state['values']['pagination_collapsed'];
$filter = $form_state['values']['pagination_filter'];
// Sadly, it's probably faster to just wipe the table and rebuild it than
// checking for existing records first.
$query = "DELETE FROM {pagination}";
db_query($query);
variable_set('pagination_showall', (int) $showall);
variable_set('pagination_ignore', $ignore);
variable_set('pagination_onebased', (int) $onebased);
variable_set('pagination_header', (int) $header);
variable_set('pagination_list_type', $listtype);
variable_set('pagination_collapsed', (int) $showhelp);
variable_set('pagination_filter', (int) $filter);
foreach ($pagination as $type => $value) {
if ($value > 0) {
$query = "INSERT INTO {pagination} (type, paginate, style) VALUES ('%s', %d, %d)";
db_query($query, $type, $value, $style[$type]);
}
}
drupal_set_message(t('Pagination settings have been updated.'));
}