You are here

function theme_node_limit_list_limits in Node Limit 7

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

Theme the node limit list form.

File

./node_limit.module, line 325

Code

function theme_node_limit_list_limits($variables) {
  $form = $variables['form'];
  $rows = array();
  foreach (element_children($form['limits']) as $key) {
    if (isset($form['limits'][$key]['title'])) {
      $limit =& $form['limits'][$key];
      $row = array();
      $row[] = drupal_render($limit['title']);
      $row[] = drupal_render($limit['limit']);
      if (isset($limit['weight'])) {
        $limit['weight']['#attributes']['class'] = array(
          'node_limit-weight',
        );
        $row[] = drupal_render($limit['weight']);
      }
      $row[] = drupal_render($limit['edit']);
      $row[] = drupal_render($limit['list']);
      $row[] = drupal_render($limit['clone']);
      $rows[] = array(
        'data' => $row,
        'class' => array(
          'draggable',
        ),
      );
    }
  }
  $header = array(
    t('Title'),
  );
  $header[] = t('Limit');
  if (isset($form['save'])) {
    $header[] = t('Weight');
    drupal_add_tabledrag('node_limit', 'order', 'sibling', 'node_limit-weight');
  }
  $header[] = array(
    'data' => t('Actions'),
    'colspan' => '3',
  );
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'empty' => t('No limit available.') . ' ' . drupal_render($form['create']),
    'attributes' => array(
      'id' => 'node_limit',
    ),
  )) . drupal_render_children($form);
}