You are here

function theme_registration_state_overview_form in Entity Registration 7.2

Same name and namespace in other branches
  1. 8.2 includes/registration.forms.inc \theme_registration_state_overview_form()
  2. 8 includes/registration.forms.inc \theme_registration_state_overview_form()
  3. 7 includes/registration.forms.inc \theme_registration_state_overview_form()

Theme handler for registration states form.

File

includes/registration.forms.inc, line 1169
Form definitions and callbacks for Registration.

Code

function theme_registration_state_overview_form($variables) {
  $form = $variables['form'];
  drupal_add_tabledrag('registration-state-admin-settings-table', 'order', 'self', 'registration-state-weight');
  $header = array(
    array(
      'data' => t('Label !required', array(
        '!required' => '<span class="form-required" title="' . t('This field is required.') . '">*</span>',
      )),
    ),
    array(
      'data' => t('Description'),
    ),
    array(
      'data' => t('Default'),
    ),
    array(
      'data' => t('Attended'),
    ),
    array(
      'data' => t('Active'),
    ),
    array(
      'data' => t('Held'),
    ),
    array(
      'data' => t('Show on form'),
    ),
    array(
      'data' => t('Weight'),
    ),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  foreach (element_children($form['state']) as $key) {
    $row = array();
    foreach (array(
      'label',
      'description',
      'default_state',
      'attended',
      'active',
      'held',
      'show_on_form',
      'weight',
      'delete',
      'export',
    ) as $element) {

      // Since we're rendering these in a table, remove any #title attributes.
      if (!empty($form['state'][$key][$element]['#title'])) {
        unset($form['state'][$key][$element]['#title']);
      }
      $row[] = drupal_render($form['state'][$key][$element]);
    }
    $rows[] = array(
      'class' => array(
        'draggable',
      ),
      'data' => $row,
    );
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'registration-state-admin-settings-table',
    ),
  ));
  $output .= drupal_render_children($form);
  return $output;
}