wysiwyg.dialog.inc 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * @file
  4. * Wysiwyg dialog page handling functions.
  5. */
  6. /**
  7. * Menu callback; Output a wysiwyg plugin dialog page.
  8. */
  9. function wysiwyg_dialog($plugin, $instance) {
  10. $plugins = wysiwyg_get_all_plugins();
  11. if (!isset($plugins[$plugin])) {
  12. return drupal_access_denied();
  13. }
  14. $callback = $plugin . '_wysiwyg_dialog';
  15. if (!function_exists($callback)) {
  16. return drupal_not_found();
  17. }
  18. // Suppress admin menu.
  19. module_invoke('admin_menu', 'suppress');
  20. // Add editor instance id to Drupal.settings.
  21. $settings = array(
  22. 'plugin' => $plugin,
  23. 'instance' => $instance,
  24. );
  25. drupal_add_js(array('wysiwyg' => $settings), 'setting');
  26. echo theme('wysiwyg_dialog_page', $callback($instance));
  27. }
  28. /**
  29. * Template preprocess function for theme_wysiwyg_dialog_page().
  30. *
  31. * @see wysiwyg_dialog()
  32. * @see wysiwyg-dialog-page.tpl.php
  33. * @see template_preprocess()
  34. */
  35. function template_preprocess_wysiwyg_dialog_page(&$variables) {
  36. // Construct page title
  37. $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal'));
  38. $variables['head_title'] = implode(' | ', $head_title);
  39. $variables['base_path'] = base_path();
  40. $variables['front_page'] = url();
  41. // @todo Would a breadcrumb make sense / possible at all?
  42. // $variables['breadcrumb'] = theme('breadcrumb', drupal_get_breadcrumb());
  43. $variables['head'] = drupal_get_html_head();
  44. $variables['help'] = theme('help');
  45. $variables['language'] = $GLOBALS['language'];
  46. $variables['language']->dir = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
  47. $variables['messages'] = $variables['show_messages'] ? theme('status_messages') : '';
  48. $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : '');
  49. $variables['css'] = drupal_add_css();
  50. $variables['styles'] = drupal_get_css();
  51. $variables['scripts'] = drupal_get_js();
  52. $variables['tabs'] = theme('menu_local_tasks');
  53. $variables['title'] = drupal_get_title();
  54. // Closure should be filled last.
  55. $variables['closure'] = theme('closure');
  56. }