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