function ckeditor_profile_features_revert in CKEditor - WYSIWYG HTML editor 7
Same name and namespace in other branches
- 6 includes/ckeditor.features.inc \ckeditor_profile_features_revert()
Implementation of hook_features_revert()
1 call to ckeditor_profile_features_revert()
- ckeditor_profile_features_rebuild in includes/
ckeditor.features.inc - Implementation of hook_features_rebuild()
File
- includes/
ckeditor.features.inc, line 96 - CKEditor - The text editor for the Internet - http://ckeditor.com Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
Code
function ckeditor_profile_features_revert($module) {
if ($data = features_get_default('ckeditor_profile', $module)) {
$input_formats = filter_formats();
foreach ($data as $name => $profile) {
// Restore the profile settings
db_query("DELETE FROM {ckeditor_settings} WHERE name = :name", array(
':name' => $name,
));
db_query("INSERT INTO {ckeditor_settings} (name, settings) VALUES(:name, :settings)", array(
':name' => $name,
':settings' => serialize($profile['settings']),
));
if (empty($profile["input_formats"])) {
// Remove input format if none is specified
db_query("DELETE FROM {ckeditor_input_format} WHERE name = :name", array(
':name' => $name,
));
}
else {
// Restore the profile roles
foreach ($profile["input_formats"] as $input_format => $input_format_name) {
if (!db_query("SELECT name FROM {ckeditor_input_format} WHERE format = :format AND name = :name", array(
':name' => $name,
':format' => $input_format,
))
->fetchField()) {
db_query("INSERT INTO {ckeditor_input_format} (name, format) VALUES(:name, :format)", array(
':name' => $name,
':format' => $input_format,
));
}
}
}
}
}
}