wysiwyg.admin.inc 21 KB

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