function theme_search_autocomplete_treelist_form in Search Autocomplete 6.4
Same name and namespace in other branches
- 6.2 search_autocomplete.form.treelist.inc \theme_search_autocomplete_treelist_form()
- 7.4 search_autocomplete.form.treelist.inc \theme_search_autocomplete_treelist_form()
- 7.2 search_autocomplete.form.treelist.inc \theme_search_autocomplete_treelist_form()
- 7.3 search_autocomplete.form.treelist.inc \theme_search_autocomplete_treelist_form()
CALLBACK: Theme function for this treelist form
File
- ./
search_autocomplete.form.treelist.inc, line 98 - Search Autocomplete Display the list of form to autocomplete and themis it as a draggable table.
Code
function theme_search_autocomplete_treelist_form($form) {
drupal_add_tabledrag('my-draggable-table', 'order', 'sibling', 'weight-group');
drupal_add_tabledrag('my-draggable-table', 'match', 'parent', 'parent-group', 'parent-group', 'id-group');
$header[] = t('Form name');
$header[] = t('Enabled');
$header[] = array(
'data' => t('Operations'),
'colspan' => '2',
);
$header[] = t('Weight');
// for each elements to anchor in the form
foreach (element_children($form['my_items']) as $key) {
$element =& $form['my_items'][$key];
$element['weight']['#attributes']['class'] = 'weight-group';
$element['fid']['#attributes']['class'] = 'id-group';
$element['parent_fid']['#attributes']['class'] = 'parent-group';
$row = array();
$row[] = theme('indentation', $element['#depth']) . drupal_render($element['title']);
$row[] = drupal_render($element['enabled']);
$row[] = drupal_render($element['operations']['configure']);
$row[] = drupal_render($element['operations']['delete']);
$row[] = drupal_render($element['weight']) . drupal_render($element['fid']) . drupal_render($element['parent_fid']);
//Add a draggable class to every table row (<tr>)
$rows[] = array(
'data' => $row,
'class' => 'draggable',
);
}
// Themize the table and render the form
$output = theme('table', $header, $rows, array(
'id' => 'my-draggable-table',
));
$output .= drupal_render($form);
return $output;
}