function wysiwyg_update_7201 in Wysiwyg 7.2
Update enabled font plugin buttons to default plugin in TinyMCE profiles.
File
- ./
wysiwyg.install, line 235 - Installation functions for Wysiwyg module.
Code
function wysiwyg_update_7201() {
$query = db_select('wysiwyg', 'w')
->fields('w', array(
'format',
'settings',
))
->condition('editor', 'tinymce');
foreach ($query
->execute() as $profile) {
$settings = unserialize($profile->settings);
// Move enabled 'font' buttons into 'default' plugin buttons.
$changed = FALSE;
foreach (array(
'formatselect',
'fontselect',
'fontsizeselect',
'styleselect',
) as $button) {
if (isset($settings['buttons']['font'][$button])) {
$settings['buttons']['default'][$button] = $settings['buttons']['font'][$button];
unset($settings['buttons']['font'][$button]);
$changed = TRUE;
}
}
if ($changed) {
db_update('wysiwyg')
->condition('format', $profile->format)
->fields(array(
'settings' => serialize($settings),
))
->execute();
}
}
}