You are here

function theme_onepageprofile_settings in One page profile 7

Same name and namespace in other branches
  1. 6 onepageprofile.module \theme_onepageprofile_settings()

Theme admin settings form

File

./onepageprofile.module, line 170

Code

function theme_onepageprofile_settings($form) {
  drupal_add_tabledrag('onepageprofile-categories', 'order', 'sibling', 'onepageprofile-element');

  // Header
  $header = array(
    t('Category'),
    t('Weight'),
  );

  // Rows for the tabledrag
  $rows = array();
  $tree =& $form['onepageprofile_categories'];
  foreach (element_children($tree) as $key) {
    $tree[$key]['weight']['#attributes']['class'] = 'onepageprofile-element';
    $row = array();
    $row[] = drupal_render($tree[$key]['title']);
    $row[] = drupal_render($tree[$key]['weight']);
    $rows[] = array(
      'data' => $row,
      'class' => 'draggable',
    );
  }

  // Build the output
  $output = '<p>' . t('Use this form to set the order of the fieldsets appearing on the user profile editing page.') . '</p>';
  $output .= theme('table', $header, $rows, array(
    'id' => 'onepageprofile-categories',
  ));
  $output .= drupal_render($form);
  return $output;
}