You are here

function theme_faq_draggable_question_order_table in Frequently Asked Questions 6

Same name and namespace in other branches
  1. 7.2 faq.module \theme_faq_draggable_question_order_table()
  2. 7 faq.module \theme_faq_draggable_question_order_table()

Theme function for question ordering drag and drop table.

File

./faq.module, line 1509
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($form) {
  drupal_add_tabledrag('question-sort', 'order', 'sibling', 'sort');
  $header = array(
    '',
    t('Question'),
    '',
    t('Sort'),
  );
  foreach (element_children($form) as $key) {

    // Add class to group weight fields for drag and drop.
    $form[$key]['sort']['#attributes']['class'] = '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' => 'draggable',
    );
  }
  $output = theme('table', $header, $rows, array(
    'id' => 'question-sort',
  ));
  $output .= drupal_render($form);
  return $output;
}