You are here

function theme_skinr_context_ui_group_list_form in Skinr 7.2

Same name and namespace in other branches
  1. 8.2 skinr_context/skinr_context_ui.edit.inc \theme_skinr_context_ui_group_list_form()

Returns HTML for the menu overview form into a table.

Parameters

$variables: An associative array containing:

  • form: A render element representing the form.

File

skinr_context/skinr_context_ui.edit.inc, line 315
Page callbacks for the Skinr Context UI module related to editing skins and groups.

Code

function theme_skinr_context_ui_group_list_form($variables) {
  $form = $variables['form'];
  drupal_add_tabledrag('skinr-context-ui-group-list', 'order', 'sibling', 'skinr-context-ui-group-weight');
  $header = array(
    t('Skin settings group'),
    array(
      'data' => t('Enabled'),
      'class' => array(
        'checkbox',
      ),
    ),
    t('Weight'),
    array(
      'data' => t('Operations'),
      'colspan' => '2',
    ),
  );
  $rows = array();
  foreach (element_children($form['groups']) as $gid) {
    if (isset($form['groups'][$gid]['status'])) {
      $element =& $form['groups'][$gid];

      // Build a list of operations.
      $operations = array();
      foreach (element_children($element['operations']) as $op) {
        $operations[] = array(
          'data' => drupal_render($element['operations'][$op]),
          'class' => array(
            'skinr-context-ui-group-operations',
          ),
        );
      }

      // Add special classes to be used for tabledrag.js.
      $element['weight']['#attributes']['class'] = array(
        'skinr-context-ui-group-weight',
      );
      $row = array();
      $row[] = drupal_render($element['info']);
      $row[] = array(
        'data' => drupal_render($element['status']),
        'class' => array(
          'checkbox',
          'skinr-context-ui-group-enabled',
        ),
      );
      $row[] = drupal_render($element['weight']);
      $row = array_merge($row, $operations);
      $row = array_merge(array(
        'data' => $row,
      ), $element['#attributes']);
      $row['class'][] = 'draggable';
      $rows[] = $row;
    }
  }
  $output = '';
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => $form['#empty_text'],
        'colspan' => '7',
      ),
    );
  }
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'skinr-context-ui-group-list',
    ),
  ));
  $output .= drupal_render_children($form);
  return $output;
}