You are here

function theme_breakpoints_admin_breakpoints_table in Breakpoints 7

Theme form as table.

1 theme call to theme_breakpoints_admin_breakpoints_table()
breakpoints_admin_breakpoints in ./breakpoints.admin.inc
Admin form

File

./breakpoints.admin.inc, line 333
Breakpoints - admin settings

Code

function theme_breakpoints_admin_breakpoints_table($variables) {
  drupal_add_css(drupal_get_path('module', 'breakpoints') . '/css/breakpoints.admin.css');
  $form = $variables['form'];
  $global = empty($form['#group_name']);

  // Rows.
  $rows = array();
  foreach (element_children($form) as $key) {
    if ($key != 'new') {
      $row = _breakpoints_admin_breakpoints_table_row($form[$key], $key, $global);
      $breakpoint = $form[$key]['#breakpoint_data'];
      $class = 'breakpoints-status-' . ($breakpoint->status ? 'enabled' : 'disabled');
    }
    else {
      $row = _breakpoints_admin_breakpoints_table_new_row($form[$key]);
      $class = 'breakpoints-status-new';
    }
    $rows[] = array(
      'data' => $row,
      'class' => array(
        'draggable',
        $class,
      ),
    );
  }

  // Header.
  $header = array();
  $header[] = array(
    'data' => t('Name'),
    'colspan' => 2,
  );
  $header[] = t('Breakpoint, @media ...');
  $header[] = t('Multipliers');
  $header[] = t('Source');
  $header[] = t('Status');
  if ($global) {
    $header[] = array(
      'data' => t('Operations'),
      'colspan' => 3,
    );
  }
  $header[] = t('Weight');
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'resp-img-breakpoints',
    ),
  ));
  drupal_add_tabledrag('resp-img-breakpoints', 'order', 'sibling', 'breakpoints-weight');
  return $output;
}