function theme_faq_draggable_question_order_table in Frequently Asked Questions 7
Same name and namespace in other branches
- 6 faq.module \theme_faq_draggable_question_order_table()
- 7.2 faq.module \theme_faq_draggable_question_order_table()
Theme function for question ordering drag and drop table.
File
- ./
faq.module, line 1841 - The FAQ module allows users to create a FAQ page, with questions and answers displayed in different styles, according to the settings.
Code
function theme_faq_draggable_question_order_table($variables) {
$form = $variables['form'];
drupal_add_tabledrag('question-sort', 'order', 'sibling', 'sort');
$header = array(
'',
t('Question'),
'',
t('Sort'),
);
$rows = array();
foreach (element_children($form) as $key) {
// Add class to group weight fields for drag and drop.
$form[$key]['sort']['#attributes']['class'] = array(
'sort',
);
$row = array(
'',
);
$row[] = drupal_render($form[$key]['title']);
$row[] = drupal_render($form[$key]['nid']);
$row[] = drupal_render($form[$key]['sort']);
$rows[] = array(
'data' => $row,
'class' => array(
'draggable',
),
);
}
$output = theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'question-sort',
),
));
$output .= drupal_render_children($form);
return $output;
}