function RegistrationViewsHandlerStateEdit::views_form in Entity Registration 8
Same name and namespace in other branches
- 8.2 modules/registration_views/registration_views.module \RegistrationViewsHandlerStateEdit::views_form()
- 7.2 modules/registration_views/registration_views.module \RegistrationViewsHandlerStateEdit::views_form()
- 7 modules/registration_views/registration_views.module \RegistrationViewsHandlerStateEdit::views_form()
Add to and alter the form.
File
- modules/
registration_views/ registration_views.module, line 327 - Entity Registration Views integration
Class
- RegistrationViewsHandlerStateEdit
- A Views' field handler for editing the registration state.
Code
function views_form(&$form, &$form_state) {
// Create a container for our replacements
$form[$this->options['id']] = array(
'#type' => 'container',
'#tree' => TRUE,
);
// Iterate over the result and add our replacement fields to the form.
foreach ($this->view->result as $row_index => $row) {
// Add a text field to the form. This array convention
// corresponds to the placeholder HTML comment syntax.
$form[$this->options['id']][$row_index] = array(
'#type' => 'select',
'#default_value' => $row->{$this->aliases['state']},
'#options' => registration_get_states_options(),
'#required' => TRUE,
);
}
}