theme.inc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * @file
  4. * Linkit theme functions.
  5. */
  6. /**
  7. * Theme callback for the search/attribute plugins in linkit_profiles_form.
  8. */
  9. function theme_linkit_plugin_form_table($variables) {
  10. $form = $variables['form'];
  11. $has_description = FALSE;
  12. $rows = array();
  13. // Iterate over each element.
  14. foreach (element_children($form) as $id) {
  15. $form[$id]['weight']['#attributes']['class'] = array('weight');
  16. $fields = array(
  17. drupal_render($form[$id]['name']),
  18. drupal_render($form[$id]['weight']),
  19. drupal_render($form[$id]['enabled']),
  20. );
  21. if (isset($form[$id]['description'])) {
  22. $has_description = TRUE;
  23. $fields[] = drupal_render($form[$id]['description']);
  24. }
  25. $rows[$id]['data'] = $fields;
  26. $rows[$id]['class'] = array('draggable');
  27. }
  28. drupal_add_tabledrag('linkit-search-plugins', 'order', 'sibling', 'weight');
  29. $header = array(
  30. t('Name'),
  31. t('Weight'),
  32. t('Enabled'),
  33. );
  34. if ($has_description) {
  35. $header[] = t('Description');
  36. }
  37. return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'linkit-search-plugins'), 'sticky' => FALSE));
  38. }