function ajaxblocks_save_settings in Ajax Blocks 6
Same name and namespace in other branches
- 7 ajaxblocks.module \ajaxblocks_save_settings()
Additional submit handler for block settings form. Saves AJAX settings for the block.
1 string reference to 'ajaxblocks_save_settings'
- ajaxblocks_form_block_admin_configure_alter in ./
ajaxblocks.module - Implements hook_form_FORM_ID_alter(). Adds AJAX settings to the block configure page.
File
- ./
ajaxblocks.module, line 133 - Loads dynamic blocks on cached page for anonymous users by performing AJAX request.
Code
function ajaxblocks_save_settings($form, &$form_state) {
$block_id = $form_state['values']['module'] . '-' . $form_state['values']['delta'];
$is_ajax = (int) $form_state['values']['ajaxblocks_is_ajax'];
$loader_picture = (int) $form_state['values']['ajaxblocks_loader_picture'];
$is_late = (int) $form_state['values']['ajaxblocks_is_late'];
$delay = (int) $form_state['values']['ajaxblocks_delay'];
$include_noscript = (int) $form_state['values']['ajaxblocks_include_noscript'];
$cached_roles = implode(' ', array_filter($form_state['values']['ajaxblocks_cached_roles']));
$uncached_roles = implode(' ', array_filter($form_state['values']['ajaxblocks_uncached_roles']));
db_query("UPDATE {ajaxblocks} SET is_ajax = %d, loader_picture = %d, is_late = %d, delay = %d, " . "include_noscript = %d, cached_roles = '%s', uncached_roles = '%s' WHERE block_id = '%s'", $is_ajax, $loader_picture, $is_late, $delay, $include_noscript, $cached_roles, $uncached_roles, $block_id);
if (!db_affected_rows()) {
db_query("INSERT INTO {ajaxblocks} (block_id, is_ajax, loader_picture, is_late, delay, " . "include_noscript, cached_roles, uncached_roles) VALUES ('%s', %d, %d, %d, %d, %d, '%s', '%s')", $block_id, $is_ajax, $loader_picture, $is_late, $delay, $include_noscript, $cached_roles, $uncached_roles);
}
ajaxblocks_update_cache();
}