-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsharer_toolbar.theme.inc
More file actions
56 lines (49 loc) · 1.52 KB
/
sharer_toolbar.theme.inc
File metadata and controls
56 lines (49 loc) · 1.52 KB
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
/**
* @file sharer_toolbar.theme.inc
* Theming functions
*/
/**
* Sharer toolbar configuration form theming function.
*/
function theme_sharer_toolbar_config_form($variables) {
$form = $variables['form'];
// Define table header
$header = array(
t('Order'),
t('Status'),
t('Name'),
t('Icon class'),
t('Label'),
t('Weight'),
);
// Render form rows as draggable table rows
$rows = array();
foreach (element_children($form['sharers']) as $sid) {
$form['sharers'][$sid]['weight']['#attributes']['class'] = array('sharers-order-weight');
$rows[] = array(
'data' => array(
array('class' => array('sharer-cross')),
drupal_render($form['sharers'][$sid]['status']),
drupal_render($form['sharers'][$sid]['name']),
drupal_render($form['sharers'][$sid]['icon_class']),
drupal_render($form['sharers'][$sid]['label']),
drupal_render($form['sharers'][$sid]['weight']),
),
'class' => array('draggable'),
);
}
// Render draggable table
$output = drupal_render($form['note']);
$output .= drupal_render($form['sharer_toolbar_title']);
$output .= drupal_render($form['sharers_order_title']);
$output .= theme('table', array(
'attributes' => array('id' => 'sharers-order'),
'header' => $header,
'rows' => $rows,
));
$output .= drupal_render_children($form);
// Add draggable feature to table#sharers-order
drupal_add_tabledrag('sharers-order', 'order', 'sibling', 'sharers-order-weight');
return $output;
}