function theme_registration_state_overview_form in Entity Registration 8
Same name and namespace in other branches
- 8.2 includes/registration.forms.inc \theme_registration_state_overview_form()
- 7.2 includes/registration.forms.inc \theme_registration_state_overview_form()
- 7 includes/registration.forms.inc \theme_registration_state_overview_form()
Theme handler for registration states form.
File
- includes/
registration.forms.inc, line 1011 - Form definitions and callbacks for Registration.
Code
function theme_registration_state_overview_form($variables) {
$form = $variables['form'];
// @FIXME
// TableDrag is now attached with the #tabledrag property of certain render
// arrays. drupal_add_tabledrag() is now internal and should never be called directly.
//
//
// @see https://www.drupal.org/node/2160571
// 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('Active'),
),
array(
'data' => t('Held'),
),
array(
'data' => t('Show on form'),
),
array(
'data' => t('Weight'),
),
array(
'data' => t('Operations'),
'colspan' => 2,
),
);
foreach (\Drupal\Core\Render\Element::children($form['state']) as $key) {
$row = array();
foreach (array(
'label',
'description',
'default_state',
'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;
}