You are here

function theme_node_registration_types_form in Node registration 7

Theme function for node_registration_types_form().

File

./node_registration.module, line 1083

Code

function theme_node_registration_types_form($variables) {
  $help_message = '<p>' . t('The following table lists the registration status for each content type. You can enable/disable registrations from the content type settings page.') . '</p>';
  $form = $variables['form'];
  $rows = array();
  foreach (element_children($form['types']) as $type) {
    $element = $form['types'][$type];
    $enabled = $element['#enabled'];
    $operations = array();
    foreach ($element['#operations'] as $op_name => $op) {
      if ($html = render($op)) {
        $operations[] = $html;
      }
    }
    $rows[] = array(
      'class' => array(
        $enabled ? 'enabled' : 'disabled',
      ),
      'data' => array(
        array(
          'data' => l($element['#name'], 'admin/structure/types/manage/' . $type),
        ),
        array(
          'class' => 'registration-status',
          'data' => $enabled ? t('Enabled') : t('Disabled'),
        ),
        implode(' | ', $operations),
      ),
    );
  }
  $table = array(
    'header' => array(
      t('Content type'),
      t('Registration status'),
      t('Operations'),
    ),
    'rows' => $rows,
    'attributes' => array(
      'class' => array(
        'node-registration',
      ),
    ),
  );
  $table = theme('table', $table);
  return $help_message . "\n" . $table . "\n" . drupal_render_children($form);
}