Save enabled/disabled status for filters in a format.
1 call to filter_admin_filters_save()
File
- modules/
filter.module, line 449 - Framework for handling filtering of content.
Code
function filter_admin_filters_save($format, $toggles) {
$current = filter_list_format($format);
$cache = true;
db_query("DELETE FROM {filters} WHERE format = %d", $format);
foreach ($toggles as $id => $checked) {
if ($checked) {
list($module, $delta) = explode('/', $id);
// Add new filters to the bottom
$weight = isset($current[$id]->weight) ? $current[$id]->weight : 10;
db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", $format, $module, $delta, $weight);
// Check if there are any 'no cache' filters
$cache &= !module_invoke($module, 'filter', 'no cache', $delta);
}
}
// Update the format's 'no cache' flag.
db_query('UPDATE {filter_formats} SET cache = %d WHERE format = %d', (int) $cache, $format);
cache_clear_all('filter:' . $format, true);
drupal_set_message(t('The input format has been updated.'));
drupal_goto('admin/filters/' . arg(2) . '/list');
}
Login or register to post comments