comparison sites/all/modules/wysiwyg/wysiwyg.admin.inc @ 0:ff03f76ab3fe

initial version
author danieleb <danielebarchiesi@me.com>
date Wed, 21 Aug 2013 18:51:11 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:ff03f76ab3fe
1 <?php
2
3 /**
4 * @file
5 * Integrate Wysiwyg editors into Drupal.
6 */
7
8 /**
9 * Form builder for Wysiwyg profile form.
10 */
11 function wysiwyg_profile_form($form, &$form_state, $profile) {
12 // Merge in defaults.
13 $profile = (array) $profile;
14 $profile += array(
15 'format' => '',
16 'editor' => '',
17 );
18 if (empty($profile['settings'])) {
19 $profile['settings'] = array();
20 }
21 $profile['settings'] += array(
22 'default' => TRUE,
23 'user_choose' => FALSE,
24 'show_toggle' => TRUE,
25 'theme' => 'advanced',
26 'language' => 'en',
27 'access' => 1,
28 'access_pages' => "node/*\nuser/*\ncomment/*",
29 'buttons' => array(),
30 'toolbar_loc' => 'top',
31 'toolbar_align' => 'left',
32 'path_loc' => 'bottom',
33 'resizing' => TRUE,
34 // Also available, but buggy in TinyMCE 2.x: blockquote,code,dt,dd,samp.
35 'block_formats' => 'p,address,pre,h2,h3,h4,h5,h6,div',
36 'verify_html' => TRUE,
37 'preformatted' => FALSE,
38 'convert_fonts_to_spans' => TRUE,
39 'remove_linebreaks' => TRUE,
40 'apply_source_formatting' => FALSE,
41 'paste_auto_cleanup_on_paste' => FALSE,
42 'css_setting' => 'theme',
43 'css_path' => NULL,
44 'css_classes' => NULL,
45 );
46 $profile = (object) $profile;
47
48 $formats = filter_formats();
49 $editor = wysiwyg_get_editor($profile->editor);
50 drupal_set_title(t('%editor profile for %format', array('%editor' => $editor['title'], '%format' => $formats[$profile->format]->name)), PASS_THROUGH);
51
52 $form['format'] = array('#type' => 'value', '#value' => $profile->format);
53 $form['input_format'] = array('#type' => 'value', '#value' => $formats[$profile->format]->name);
54 $form['editor'] = array('#type' => 'value', '#value' => $profile->editor);
55
56 $form['basic'] = array(
57 '#type' => 'fieldset',
58 '#title' => t('Basic setup'),
59 '#collapsible' => TRUE,
60 '#collapsed' => TRUE,
61 );
62
63 $form['basic']['default'] = array(
64 '#type' => 'checkbox',
65 '#title' => t('Enabled by default'),
66 '#default_value' => $profile->settings['default'],
67 '#return_value' => 1,
68 '#description' => t('The default editor state for users having access to this profile. Users are able to override this state if the next option is enabled.'),
69 );
70
71 $form['basic']['user_choose'] = array(
72 '#type' => 'checkbox',
73 '#title' => t('Allow users to choose default'),
74 '#default_value' => $profile->settings['user_choose'],
75 '#return_value' => 1,
76 '#description' => t('If allowed, users will be able to choose their own editor default state in their user account settings.'),
77 );
78
79 $form['basic']['show_toggle'] = array(
80 '#type' => 'checkbox',
81 '#title' => t('Show <em>enable/disable rich text</em> toggle link'),
82 '#default_value' => $profile->settings['show_toggle'],
83 '#return_value' => 1,
84 '#description' => t('Whether or not to show the <em>enable/disable rich text</em> toggle link below a textarea. If disabled, the user setting or global default is used (see above).'),
85 );
86
87 $form['basic']['theme'] = array(
88 '#type' => 'hidden',
89 '#value' => $profile->settings['theme'],
90 );
91
92 $form['basic']['language'] = array(
93 '#type' => 'select',
94 '#title' => t('Interface language'),
95 '#default_value' => $profile->settings['language'],
96 );
97 // @see _locale_prepare_predefined_list()
98 require_once DRUPAL_ROOT . '/includes/iso.inc';
99 $predefined = _locale_get_predefined_list();
100 foreach ($predefined as $key => $value) {
101 // Include native name in output, if possible
102 if (count($value) > 1) {
103 $tname = t($value[0]);
104 $predefined[$key] = ($tname == $value[1]) ? $tname : "$tname ($value[1])";
105 }
106 else {
107 $predefined[$key] = t($value[0]);
108 }
109 }
110 asort($predefined);
111 $form['basic']['language']['#options'] = $predefined;
112
113 $form['buttons'] = array(
114 '#type' => 'fieldset',
115 '#title' => t('Buttons and plugins'),
116 '#collapsible' => TRUE,
117 '#collapsed' => TRUE,
118 '#tree' => TRUE,
119 '#theme' => 'wysiwyg_admin_button_table',
120 );
121
122 $plugins = wysiwyg_get_plugins($profile->editor);
123 // Generate the button list.
124 foreach ($plugins as $name => $meta) {
125 if (isset($meta['buttons']) && is_array($meta['buttons'])) {
126 foreach ($meta['buttons'] as $button => $title) {
127 $icon = '';
128 if (!empty($meta['path'])) {
129 // @todo Button icon locations are different in editors, editor versions,
130 // and contrib/custom plugins (like Image Assist, f.e.).
131 $img_src = $meta['path'] . "/images/$name.gif";
132 // Handle plugins that have more than one button.
133 if (!file_exists($img_src)) {
134 $img_src = $meta['path'] . "/images/$button.gif";
135 }
136 $icon = file_exists($img_src) ? '<img src="' . base_path() . $img_src . '" title="' . $button . '" style="border: 1px solid grey; vertical-align: middle;" />' : '';
137 }
138 $title = (!empty($icon) ? $icon . ' ' . check_plain($title) : check_plain($title));
139 $form['buttons'][$name][$button] = array(
140 '#type' => 'checkbox',
141 '#title' => $title,
142 '#default_value' => !empty($profile->settings['buttons'][$name][$button]) ? $profile->settings['buttons'][$name][$button] : FALSE,
143 '#description' => isset($meta['url']) ? l($meta['url'], $meta['url']) : NULL,
144 );
145 }
146 }
147 elseif (isset($meta['extensions']) && is_array($meta['extensions'])) {
148 foreach ($meta['extensions'] as $extension => $title) {
149 $form['buttons'][$name][$extension] = array(
150 '#type' => 'checkbox',
151 '#title' => check_plain($title),
152 '#default_value' => !empty($profile->settings['buttons'][$name][$extension]) ? $profile->settings['buttons'][$name][$extension] : FALSE,
153 '#description' => isset($meta['url']) ? l($meta['url'], $meta['url']) : NULL,
154 );
155 }
156 }
157 }
158
159 $form['appearance'] = array(
160 '#type' => 'fieldset',
161 '#title' => t('Editor appearance'),
162 '#collapsible' => TRUE,
163 '#collapsed' => TRUE,
164 );
165
166 $form['appearance']['toolbar_loc'] = array(
167 '#type' => 'select',
168 '#title' => t('Toolbar location'),
169 '#default_value' => $profile->settings['toolbar_loc'],
170 '#options' => array('bottom' => t('Bottom'), 'top' => t('Top')),
171 '#description' => t('This option controls whether the editor toolbar is displayed above or below the editing area.'),
172 );
173
174 $form['appearance']['toolbar_align'] = array(
175 '#type' => 'select',
176 '#title' => t('Button alignment'),
177 '#default_value' => $profile->settings['toolbar_align'],
178 '#options' => array('center' => t('Center'), 'left' => t('Left'), 'right' => t('Right')),
179 '#description' => t('This option controls the alignment of icons in the editor toolbar.'),
180 );
181
182 $form['appearance']['path_loc'] = array(
183 '#type' => 'select',
184 '#title' => t('Path location'),
185 '#default_value' => $profile->settings['path_loc'],
186 '#options' => array('none' => t('Hide'), 'top' => t('Top'), 'bottom' => t('Bottom')),
187 '#description' => t('Where to display the path to HTML elements (i.e. <code>body > table > tr > td</code>).'),
188 );
189
190 $form['appearance']['resizing'] = array(
191 '#type' => 'checkbox',
192 '#title' => t('Enable resizing button'),
193 '#default_value' => $profile->settings['resizing'],
194 '#return_value' => 1,
195 '#description' => t('This option gives you the ability to enable/disable the resizing button. If enabled, the Path location toolbar must be set to "Top" or "Bottom" in order to display the resize icon.'),
196 );
197
198 $form['output'] = array(
199 '#type' => 'fieldset',
200 '#title' => t('Cleanup and output'),
201 '#collapsible' => TRUE,
202 '#collapsed' => TRUE,
203 );
204
205 $form['output']['verify_html'] = array(
206 '#type' => 'checkbox',
207 '#title' => t('Verify HTML'),
208 '#default_value' => $profile->settings['verify_html'],
209 '#return_value' => 1,
210 '#description' => t('If enabled, potentially malicious code like <code>&lt;HEAD&gt;</code> tags will be removed from HTML contents.'),
211 );
212
213 $form['output']['preformatted'] = array(
214 '#type' => 'checkbox',
215 '#title' => t('Preformatted'),
216 '#default_value' => $profile->settings['preformatted'],
217 '#return_value' => 1,
218 '#description' => t('If enabled, the editor will insert TAB characters on tab and preserve other whitespace characters just like a PRE element in HTML does.'),
219 );
220
221 $form['output']['convert_fonts_to_spans'] = array(
222 '#type' => 'checkbox',
223 '#title' => t('Convert &lt;font&gt; tags to styles'),
224 '#default_value' => $profile->settings['convert_fonts_to_spans'],
225 '#return_value' => 1,
226 '#description' => t('If enabled, HTML tags declaring the font size, font family, font color and font background color will be replaced by inline CSS styles.'),
227 );
228
229 $form['output']['remove_linebreaks'] = array(
230 '#type' => 'checkbox',
231 '#title' => t('Remove linebreaks'),
232 '#default_value' => $profile->settings['remove_linebreaks'],
233 '#return_value' => 1,
234 '#description' => t('If enabled, the editor will remove most linebreaks from contents. Disabling this option could avoid conflicts with other input filters.'),
235 );
236
237 $form['output']['apply_source_formatting'] = array(
238 '#type' => 'checkbox',
239 '#title' => t('Apply source formatting'),
240 '#default_value' => $profile->settings['apply_source_formatting'],
241 '#return_value' => 1,
242 '#description' => t('If enabled, the editor will re-format the HTML source code. Disabling this option could avoid conflicts with other input filters.'),
243 );
244
245 $form['output']['paste_auto_cleanup_on_paste'] = array(
246 '#type' => 'checkbox',
247 '#title' => t('Force cleanup on standard paste'),
248 '#default_value' => $profile->settings['paste_auto_cleanup_on_paste'],
249 '#return_value' => 1,
250 '#description' => t('If enabled, the default paste function (CTRL-V or SHIFT-INS) behaves like the "paste from word" plugin function.'),
251 );
252
253 $form['css'] = array(
254 '#type' => 'fieldset',
255 '#title' => t('CSS'),
256 '#collapsible' => TRUE,
257 '#collapsed' => TRUE,
258 );
259
260 $form['css']['block_formats'] = array(
261 '#type' => 'textfield',
262 '#title' => t('Block formats'),
263 '#default_value' => $profile->settings['block_formats'],
264 '#size' => 40,
265 '#maxlength' => 250,
266 '#description' => t('Comma separated list of HTML block formats. Possible values: <code>@format-list</code>.', array('@format-list' => 'p,h1,h2,h3,h4,h5,h6,div,blockquote,address,pre,code,dt,dd')),
267 );
268
269 $form['css']['css_setting'] = array(
270 '#type' => 'select',
271 '#title' => t('Editor CSS'),
272 '#default_value' => $profile->settings['css_setting'],
273 '#options' => array('theme' => t('Use theme CSS'), 'self' => t('Define CSS'), 'none' => t('Editor default CSS')),
274 '#description' => t('Defines the CSS to be used in the editor area.<br />Use theme CSS - loads stylesheets from current site theme.<br/>Define CSS - enter path for stylesheet files below.<br />Editor default CSS - uses default stylesheets from editor.'),
275 );
276
277 $form['css']['css_path'] = array(
278 '#type' => 'textfield',
279 '#title' => t('CSS path'),
280 '#default_value' => $profile->settings['css_path'],
281 '#size' => 40,
282 '#maxlength' => 255,
283 '#description' => t('If "Define CSS" was selected above, enter path to a CSS file or a list of CSS files separated by a comma.') . '<br />' . t('Available tokens: <code>%b</code> (base path, eg: <code>/</code>), <code>%t</code> (path to theme, eg: <code>themes/garland</code>)') . '<br />' . t('Example:') . ' css/editor.css,/themes/garland/style.css,%b%t/style.css,http://example.com/external.css',
284 );
285
286 $form['css']['css_classes'] = array(
287 '#type' => 'textarea',
288 '#title' => t('CSS classes'),
289 '#default_value' => $profile->settings['css_classes'],
290 '#description' => t('Optionally define CSS classes for the "Font style" dropdown list.<br />Enter one class on each line in the format: !format. Example: !example<br />If left blank, CSS classes are automatically imported from all loaded stylesheet(s).', array('!format' => '<code>[title]=[class]</code>', '!example' => 'My heading=header1')),
291 );
292
293 $form['submit'] = array(
294 '#type' => 'submit',
295 '#value' => t('Save'),
296 '#weight' => 100,
297 );
298 $form['cancel'] = array(
299 '#value' => l(t('Cancel'), 'admin/config/content/wysiwyg'),
300 '#weight' => 110,
301 );
302
303 // Supply contextual information for other callbacks and handlers.
304 // @todo Modernize this form for D7+ and declare these earlier.
305 // $profile is the primary object of this form, and as an entity, usually
306 // expected to live in $form_state[$entity_type].
307 $form_state['wysiwyg_profile'] = $profile;
308 $form_state['wysiwyg']['editor'] = $editor;
309 $form_state['wysiwyg']['plugins'] = $plugins;
310
311 // Allow editor library specific changes to be made to the form.
312 if (isset($editor['settings form callback'])) {
313 $editor['settings form callback']($form, $form_state);
314 }
315
316 return $form;
317 }
318
319 /**
320 * Submit callback for Wysiwyg profile form.
321 *
322 * @see wysiwyg_profile_form()
323 */
324 function wysiwyg_profile_form_submit($form, &$form_state) {
325 $values = $form_state['values'];
326 if (isset($values['buttons'])) {
327 // Store only enabled buttons for each plugin.
328 foreach ($values['buttons'] as $plugin => $buttons) {
329 $values['buttons'][$plugin] = array_filter($values['buttons'][$plugin]);
330 }
331 // Store only enabled plugins.
332 $values['buttons'] = array_filter($values['buttons']);
333 }
334 // Remove any white-space from 'block_formats' setting, since editor
335 // implementations rely on a comma-separated list to explode().
336 $values['block_formats'] = preg_replace('@\s+@', '', $values['block_formats']);
337
338 // Remove input format name.
339 $format = $values['format'];
340 $input_format = $values['input_format'];
341 $editor = $values['editor'];
342 unset($values['format'], $values['input_format'], $values['editor']);
343
344 // Remove FAPI values.
345 // @see system_settings_form_submit()
346 unset($values['submit'], $values['form_id'], $values['op'], $values['form_token'], $values['form_build_id']);
347
348 // Insert new profile data.
349 db_merge('wysiwyg')
350 ->key(array('format' => $format))
351 ->fields(array(
352 'editor' => $editor,
353 'settings' => serialize($values),
354 ))
355 ->execute();
356 wysiwyg_profile_cache_clear();
357
358 drupal_set_message(t('Wysiwyg profile for %format has been saved.', array('%format' => $input_format)));
359
360 $form_state['redirect'] = 'admin/config/content/wysiwyg';
361 }
362
363 /**
364 * Layout for the buttons in the Wysiwyg Editor profile form.
365 */
366 function theme_wysiwyg_admin_button_table($variables) {
367 $form = $variables['form'];
368 $buttons = array();
369
370 // Flatten forms array.
371 foreach (element_children($form) as $name) {
372 foreach (element_children($form[$name]) as $button) {
373 $buttons[] = drupal_render($form[$name][$button]);
374 }
375 }
376
377 // Split checkboxes into rows with 3 columns.
378 $total = count($buttons);
379 $rows = array();
380 for ($i = 0; $i < $total; $i += 3) {
381 $row = array();
382 $row_buttons = array_slice($buttons, $i, 3) + array_fill(0, 3, array());
383 foreach ($row_buttons as $row_button) {
384 $row[] = array('data' => $row_button);
385 }
386 $rows[] = $row;
387 }
388
389 $output = theme('table', array('rows' => $rows, 'attributes' => array('width' => '100%')));
390
391 return $output;
392 }
393
394 /**
395 * Display overview of setup Wysiwyg Editor profiles; menu callback.
396 */
397 function wysiwyg_profile_overview($form, &$form_state) {
398 include_once './includes/install.inc';
399
400 // Check which wysiwyg editors are installed.
401 $editors = wysiwyg_get_all_editors();
402 $count = count($editors);
403 $status = array();
404 $options = array('' => t('No editor'));
405
406 // D7's seven theme displays links in table headers as block elements.
407 drupal_add_css('table.system-status-report th a {display: inline;}', 'inline');
408
409 foreach ($editors as $name => $editor) {
410 $status[$name] = array(
411 'severity' => (isset($editor['error']) ? REQUIREMENT_ERROR : ($editor['installed'] ? REQUIREMENT_OK : REQUIREMENT_INFO)),
412 'title' => t('<a href="!vendor-url">@editor</a> (<a href="!download-url">Download</a>)', array('!vendor-url' => $editor['vendor url'], '@editor' => $editor['title'], '!download-url' => $editor['download url'])),
413 'value' => (isset($editor['installed version']) ? $editor['installed version'] : t('Not installed.')),
414 'description' => (isset($editor['error']) ? $editor['error'] : ''),
415 );
416 if ($editor['installed']) {
417 $options[$name] = $editor['title'] . (isset($editor['installed version']) ? ' ' . $editor['installed version'] : '');
418 }
419 else {
420 // Build on-site installation instructions.
421 // @todo Setup $library in wysiwyg_load_editor() already.
422 $library = (isset($editor['library']) ? $editor['library'] : key($editor['libraries']));
423 $targs = array(
424 '@editor-path' => $editor['editor path'],
425 '@library-filepath' => $editor['library path'] . '/' . (isset($editor['libraries'][$library]['files'][0]) ? $editor['libraries'][$library]['files'][0] : key($editor['libraries'][$library]['files'])),
426 );
427 $instructions = '<p>' . t('Extract the archive and copy its contents into a new folder in the following location:<br /><code>@editor-path</code>', $targs) . '</p>';
428 $instructions .= '<p>' . t('So the actual library can be found at:<br /><code>@library-filepath</code>', $targs) . '</p>';
429
430 // Add any install notes.
431 if (!empty($editor['install note callback']) && function_exists($editor['install note callback'])) {
432 $instructions .= '<div class="editor-install-note">' . $editor['install note callback']() . '</div>';
433 }
434
435 $status[$name]['description'] .= $instructions;
436 $count--;
437 }
438 // In case there is an error, always show installation instructions.
439 if (isset($editor['error'])) {
440 $show_instructions = TRUE;
441 }
442 }
443 if (!$count) {
444 $show_instructions = TRUE;
445 }
446 $form['status'] = array(
447 '#type' => 'fieldset',
448 '#title' => t('Installation instructions'),
449 '#collapsible' => TRUE,
450 '#collapsed' => !isset($show_instructions),
451 '#description' => (!$count ? t('There are no editor libraries installed currently. The following list contains a list of currently supported editors:') : ''),
452 '#weight' => 10,
453 );
454 $form['status']['report'] = array('#markup' => theme('status_report', array('requirements' => $status)));
455
456 if (!$count) {
457 return $form;
458 }
459
460 $formats = filter_formats();
461 $profiles = wysiwyg_profile_load_all();
462 $form['formats'] = array(
463 '#type' => 'item',
464 '#description' => t('To assign a different editor to a text format, click "delete" to remove the existing first.'),
465 '#tree' => TRUE,
466 );
467
468 $enable_save = FALSE;
469 foreach ($formats as $id => $format) {
470 $form['formats'][$id]['name'] = array(
471 '#markup' => check_plain($format->name),
472 );
473 // Only display editor selection for associated input formats to avoid
474 // confusion about disabled selection.
475 if (isset($profiles[$id]) && !empty($profiles[$id]->editor)) {
476 $editor_name = $profiles[$id]->editor;
477 $installed = !empty($editors[$editor_name]['installed']);
478 $form['formats'][$id]['editor'] = array(
479 '#wysiwyg-editor-name' => $editor_name,
480 );
481 if ($installed) {
482 $form['formats'][$id]['editor']['#markup'] = $options[$editor_name];
483 }
484 else {
485 drupal_set_message(t('Missing %editor library for %format format. Re-install the %editor library or delete the editor profile.', array(
486 '%editor' => $editors[$editor_name]['title'],
487 '%format' => $format->name,
488 )), 'warning');
489 }
490 }
491 else {
492 $form['formats'][$id]['editor'] = array(
493 '#type' => 'select',
494 '#default_value' => '',
495 '#options' => $options,
496 );
497 $enable_save = TRUE;
498 }
499 if (isset($profiles[$id]) && !empty($profiles[$id]->editor)) {
500 $form['formats'][$id]['edit'] = array(
501 '#markup' => l(t('Edit'), "admin/config/content/wysiwyg/profile/$id/edit"),
502 );
503 $form['formats'][$id]['delete'] = array(
504 '#markup' => l(t('Delete'), "admin/config/content/wysiwyg/profile/$id/delete"),
505 );
506 }
507 }
508
509 // Submitting the form when no editors can be selected causes errors.
510 if ($enable_save) {
511 $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
512 }
513 return $form;
514 }
515
516 /**
517 * Return HTML for the Wysiwyg profile overview form.
518 */
519 function theme_wysiwyg_profile_overview($variables) {
520 $form = $variables['form'];
521 if (!isset($form['formats'])) {
522 return;
523 }
524 $editors = wysiwyg_get_all_editors();
525 $output = '';
526 $header = array(t('Text format'), t('Editor'), array('data' => t('Operations'), 'colspan' => 2));
527 $rows = array();
528 foreach (element_children($form['formats']) as $item) {
529 $format = &$form['formats'][$item];
530 $row = array(
531 'data' => array(
532 drupal_render($format['name']),
533 drupal_render($format['editor']),
534 isset($format['edit']) ? drupal_render($format['edit']) : '',
535 isset($format['delete']) ? drupal_render($format['delete']) : '',
536 ),
537 );
538 if (empty($row['data'][1])) {
539 $row['data'][1] = array(
540 'data' => t('Missing library: @library', array('@library' => $editors[$format['editor']['#wysiwyg-editor-name']]['title'])),
541 'class' => 'error',
542 );
543 $row['class'] = array('error');
544 }
545 $rows[] = $row;
546 }
547 $form['formats']['table']['#markup'] = theme('table', array('header' => $header, 'rows' => $rows));
548 $output .= drupal_render_children($form);
549 return $output;
550 }
551
552 /**
553 * Submit callback for Wysiwyg profile overview form.
554 */
555 function wysiwyg_profile_overview_submit($form, &$form_state) {
556 foreach ($form_state['values']['formats'] as $format => $values) {
557 db_merge('wysiwyg')
558 ->key(array('format' => $format))
559 ->fields(array(
560 'editor' => $values['editor'],
561 ))
562 ->execute();
563 }
564 wysiwyg_profile_cache_clear();
565 }
566
567 /**
568 * Delete editor profile confirmation form.
569 */
570 function wysiwyg_profile_delete_confirm($form, &$form_state, $profile) {
571 $formats = filter_formats();
572 $format = $formats[$profile->format];
573 $form['format'] = array('#type' => 'value', '#value' => $format);
574 return confirm_form(
575 $form,
576 t('Are you sure you want to remove the profile for %name?', array('%name' => $format->name)),
577 'admin/config/content/wysiwyg',
578 t('This action cannot be undone.'), t('Remove'), t('Cancel')
579 );
580 }
581
582 /**
583 * Submit callback for Wysiwyg profile delete form.
584 *
585 * @see wysiwyg_profile_delete_confirm()
586 */
587 function wysiwyg_profile_delete_confirm_submit($form, &$form_state) {
588 $format = $form_state['values']['format'];
589 wysiwyg_profile_delete($format->format);
590 wysiwyg_profile_cache_clear();
591
592 drupal_set_message(t('Wysiwyg profile for %name has been deleted.', array('%name' => $format->name)));
593 $form_state['redirect'] = 'admin/config/content/wysiwyg';
594 }