1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Sweaver theming functions.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Editor frontend.
|
10
|
*/
|
11
|
function template_preprocess_sweaver_plugin(&$vars) {
|
12
|
$form = &$vars['form'];
|
13
|
$active_tab = '';
|
14
|
$sweaver_open = '';
|
15
|
$sweaver_height = '';
|
16
|
$vars['tabs'] = array();
|
17
|
$vars['tabs_data'] = array();
|
18
|
$vars['sweaver_popup'] = '';
|
19
|
|
20
|
$i = 0;
|
21
|
asort($form['#plugins_order']);
|
22
|
foreach ($form['#plugins_order'] as $plugin_name => $weight) {
|
23
|
if ($i == 0 && $plugin_name != 'sweaver_plugin') {
|
24
|
$active_tab = $plugin_name;
|
25
|
$i++;
|
26
|
}
|
27
|
$object = Sweaver::get_instance()->get_plugin($plugin_name);
|
28
|
$object->sweaver_form_render($vars, $form, $form['#plugins_full'][$plugin_name]);
|
29
|
}
|
30
|
|
31
|
// Active tab.
|
32
|
if (isset($_COOKIE['sweaver_active_tab']) && !empty($_COOKIE['sweaver_active_tab'])) {
|
33
|
$active_tab = str_replace('tab-', '', $_COOKIE['sweaver_active_tab']);
|
34
|
}
|
35
|
$vars['active_tab'] = $active_tab;
|
36
|
|
37
|
// Open or closed.
|
38
|
if (isset($_COOKIE['sweaver_open']) && !empty($_COOKIE['sweaver_open'])) {
|
39
|
$sweaver_open = $_COOKIE['sweaver_open'];
|
40
|
}
|
41
|
$vars['sweaver_open'] = $sweaver_open;
|
42
|
// Height of content area.
|
43
|
if (isset($_COOKIE['sweaver_height']) && !empty($_COOKIE['sweaver_height'])) {
|
44
|
$sweaver_height = $_COOKIE['sweaver_height'];
|
45
|
}
|
46
|
$vars['sweaver_height'] = $sweaver_height;
|
47
|
// Rest of the form.
|
48
|
$vars['rest_of_form'] = drupal_render_children($form);
|
49
|
}
|