You are here

function theme_node_limit_list_limits in Node Limit 6

Same name and namespace in other branches
  1. 8 old/node_limit.module \theme_node_limit_list_limits()
  2. 7 node_limit.module \theme_node_limit_list_limits()

Theme the node limit list form.

File

./node_limit.module, line 189
Module to restrict the number of nodes a user or role may create.

Code

function theme_node_limit_list_limits($form) {
  $header = array(
    t('Title'),
    t('Limit'),
    t('Weight'),
    t('Actions'),
  );
  $rows = array();
  foreach (element_children($form['limits']) as $lid) {
    $row = array();
    $form['limits'][$lid]['weight']['#attributes']['class'] = 'node_limit-weight';
    $row[] = drupal_render($form['limits'][$lid]['title']);
    $row[] = drupal_render($form['limits'][$lid]['nlimit']);
    $row[] = drupal_render($form['limits'][$lid]['weight']);
    $row[] = drupal_render($form['limits'][$lid]['actions']);
    $rows[] = array(
      'data' => $row,
      'class' => 'draggable',
    );
  }
  if (count($rows) > 0) {
    $out = theme('table', $header, $rows, array(
      'id' => 'node_limit-table',
    ));
  }
  $out .= drupal_render($form);
  drupal_add_tabledrag('node_limit-table', 'order', 'sibling', 'node_limit-weight');
  return $out;
}