tripal_bulk_loader.theme.inc 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Theme the regex data in the tripal_bulk_loader_template_field_form form
  4. */
  5. function tripal_bulk_loader_field_regex_fieldset($variables) {
  6. $element = $variables['element'];
  7. drupal_add_tabledrag('regex_list_form_id', 'order', 'sibling', 'rank-weight'); // needed for table dragging
  8. $header = array(
  9. 'Match Pattern',
  10. 'Replacement Pattern',
  11. 'Order',
  12. ''
  13. );
  14. $rows = array();
  15. foreach (element_children($element) as $key) {
  16. $row = array();
  17. $row['data'][] = $element[$key]['pattern']['#markup'];
  18. $row['data'][] = $element[$key]['replace']['#markup'];
  19. $row['data'][] = drupal_render($element[$key]['new_index']) . drupal_render($element[$key]['id']);
  20. $row['data'][] = drupal_render($element[$key]['submit-delete']);
  21. $row['class'] = array('draggable'); // needed for table dragging
  22. $rows[] = $row;
  23. }
  24. return theme('table', array(
  25. 'header' => $header,
  26. 'rows' => $rows,
  27. 'attributes' => array('id' => 'regex_list_form_id'), // needed for table dragging
  28. ));
  29. }