You are here

function theme_party_settings_pieces_order_form in Party 8.2

Same name and namespace in other branches
  1. 7 party.admin.inc \theme_party_settings_pieces_order_form()

Themes the pieces overview form as a sortable list of pieces.

Parameters

$variables: An associative array containing:

  • form: A render element representing the form.

See also

party_settings_pieces_order_form()

File

./party.admin.inc, line 285
Admin page callback file for the party module.

Code

function theme_party_settings_pieces_order_form($variables) {
  $form = $variables['form'];
  $rows = array();
  foreach (element_children($form['pieces']) as $key) {
    $piece =& $form['pieces'][$key];
    $row = array();
    $row[] = drupal_render($piece['name']);
    if (isset($piece['weight'])) {
      $piece['weight']['#attributes']['class'] = array(
        'piece-weight',
      );
      $row[] = drupal_render($piece['weight']);
    }
    $rows[] = array(
      'data' => $row,
      'class' => array(
        'draggable',
      ),
    );
  }
  $header = array(
    t('Piece label'),
  );
  if (isset($form['actions'])) {
    $header[] = t('Weight');
    drupal_add_tabledrag('crm-party-pieces-order', 'order', 'sibling', 'piece-weight');
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'crm-party-pieces-order',
    ),
  )) . drupal_render_children($form);
}