You are here

function theme_node_limit_limit_form in Node Limit 6

Theme the admin settings form so that we have tables inside fieldsets.

File

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

Code

function theme_node_limit_limit_form($form) {
  if (!isset($form['info'])) {
    return;
  }
  $rows = array();
  foreach ($form['node_limit_elements'] as $module => &$element) {
    if (is_array($element['applies']) && is_array($element['element'])) {
      if ($element['element']['#custom_render'] === TRUE && module_hook($module, 'node_limit_render_element')) {

        // We can't use module_invoke because form elements must be passed byref.
        $func = $module . '_node_limit_render_element';
        $rendered_element = $func($element['element']);
      }
      else {
        $rendered_element = drupal_render($element['element']);
      }
      $rows[] = array(
        drupal_render($element['applies']),
        $rendered_element,
      );
    }
  }
  $output = drupal_render($form['info']);
  if (count($rows) > 0) {
    $output .= theme('table', array(
      t('Applies to:'),
      '',
    ), $rows);
  }
  $output .= drupal_render($form);
  return $output;
}