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