-
Notifications
You must be signed in to change notification settings - Fork 10
/
atrium_folders.theme.inc
56 lines (48 loc) · 1.81 KB
/
atrium_folders.theme.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
function theme_folder_toolbar_fieldset($element) {
$output .= '<div class="left"><div class="inner">';
$output .= ' <div class="title">'. $element['#title'] .'</div>';
$output .= ' <div class="description">'. $element['#description'] .'</div>';
$output .= '</div></div>';
$output .= '<div class="right"><div class="inner">';
foreach (element_children($element) as $name) {
$output .= drupal_render($element[$name]);
}
$output .= '</div></div>';
return $output;
}
function theme_folder_toolbar_form($form) {
$output = '';
$links = array();
$buttons = array();
drupal_add_js(drupal_get_path('module', 'atrium_folders') .'/js/atrium_folders_toolbar.js');
$buttons = $form['buttons'];
$buttons['#weight'] = 1000;
unset($form['buttons']);
foreach (element_children($form) as $name) {
if ($form[$name]['#theme'] == 'folder_toolbar_fieldset') {
$links[$name]['title'] = $form[$name]['#title'];
$links[$name]['href'] = $_GET['q'];
$links[$name]['fragment'] = $name;
$links[$name]['attributes'] = array('class' => 'folder-toolbar-link');
$form[$name]['#attributes'] = array('id' => $name, 'class' => 'folder-toolbar-fieldset');
unset($buttons['preview']);
unset($buttons['preview_changes']);
$form[$name]['buttons'] = $buttons;
$form[$name]['buttons']['#prefix'] = '<div class="buttons" style="display: block;">';
$form[$name]['buttons']['#suffix'] = '</div>';
$output .= drupal_render($form[$name]);
}
else {
$form[$name]['#attributes'] = array('style' => 'display: none;');
$output .= drupal_render($form[$name]);
}
}
return '<div class="buttons">'. theme('links', $links) .'</div>' . $output;
}
/**
* Theme textfields element
*/
function theme_textfields($element) {
return $element['#children'];
}