public function EventSettingsForm::buildForm in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 src/Form/EventSettingsForm.php \Drupal\rng\Form\EventSettingsForm::buildForm()
- 3.x src/Form/EventSettingsForm.php \Drupal\rng\Form\EventSettingsForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- src/
Form/ EventSettingsForm.php, line 53
Class
- EventSettingsForm
- Configure event settings.
Namespace
Drupal\rng\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $rng_event = NULL) {
$entity = clone $rng_event;
$form_state
->set('event', $entity);
$display = entity_get_form_display($entity
->getEntityTypeId(), $entity
->bundle(), 'rng_event');
$form_state
->set('form_display', $display);
$form['event'] = [
'#weight' => 0,
];
$display
->buildForm($entity, $form['event'], $form_state);
$form['actions'] = [
'#type' => 'actions',
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => t('Save'),
'#button_type' => 'primary',
];
return $form;
}