public function EventTypeDefaultMessagesAddForm::buildForm in RNG - Events and Registrations 3.x
Same name and namespace in other branches
- 8.2 src/Form/EventTypeDefaultMessagesAddForm.php \Drupal\rng\Form\EventTypeDefaultMessagesAddForm::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/ EventTypeDefaultMessagesAddForm.php, line 48
Class
- EventTypeDefaultMessagesAddForm
- Add a new default message to this event type.
Namespace
Drupal\rng\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
// @TODO : Move this and other occurences into a common place?.
$triggers = [
'rng:custom:date' => $this
->t('To all registrations, on a date.'),
(string) $this
->t('Registrations') => [
'entity:registration:new' => $this
->t('To a single registration, when it is created.'),
'entity:registration:update' => $this
->t('To a single registration, when it is updated.'),
],
];
$form['trigger'] = [
'#type' => 'select',
'#options' => $triggers,
'#title' => $this
->t('Trigger'),
];
$form['status'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enabled'),
];
$form['subject'] = [
'#type' => 'textfield',
'#title' => $this
->t('Subject'),
'#required' => TRUE,
];
$form['body'] = [
'#type' => 'textarea',
'#title' => $this
->t('Body'),
'#required' => TRUE,
];
$form['actions'] = [
'#type' => 'actions',
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Save'),
];
return $form;
}