17
17
/**
18
18
* Form for event type default message.
19
19
*/
20
- class EventTypeDefaultMessagesForm extends EntityForm {
20
+ class EventTypeDefaultMessagesListForm extends EntityForm {
21
21
22
22
/**
23
23
* The redirect destination service.
@@ -112,13 +112,18 @@ public function buildForm(array $form, FormStateInterface $form_state) {
112
112
113
113
// @TODO : Move this and other occurences into a common place?.
114
114
// @see EventTypeDefaultMessagesAddForm::buildForm.
115
- $ triggers = [
115
+ $ trigger_options = [
116
116
'rng:custom:date ' => $ this ->t ('To all registrations, on a date. ' ),
117
117
(string ) $ this ->t ('Registrations ' ) => [
118
118
'entity:registration:new ' => $ this ->t ('To a single registration, when it is created. ' ),
119
119
'entity:registration:update ' => $ this ->t ('To a single registration, when it is updated. ' ),
120
120
],
121
121
];
122
+ $ trigger_labels = [
123
+ 'entity:registration:new ' => $ this ->t ('Registration creation ' ),
124
+ 'entity:registration:update ' => $ this ->t ('Registration updated ' ),
125
+ 'rng:custom:date ' => $ this ->t ('Send on a date ' ),
126
+ ];
122
127
123
128
$ form ['messages ' ] = [
124
129
'#type ' => 'container ' ,
@@ -131,17 +136,14 @@ public function buildForm(array $form, FormStateInterface $form_state) {
131
136
$ form ['messages ' ][$ key ] = [
132
137
'#type ' => 'details ' ,
133
138
'#tree ' => TRUE ,
134
- '#title ' => $ message ['label ' ],
135
- ];
136
- $ form ['messages ' ][$ key ]['label ' ] = [
137
- '#type ' => 'textfield ' ,
138
- '#title ' => $ this ->t ('Label ' ),
139
- '#default_value ' => $ message ['label ' ],
140
- '#required ' => TRUE ,
139
+ '#title ' => $ this ->t ('@label (@status) ' , [
140
+ '@label ' => isset ($ trigger_labels [$ message ['trigger ' ]]) ? $ trigger_labels [$ message ['trigger ' ]] : $ message ['trigger ' ],
141
+ '@status ' => $ message ['status ' ] ? $ this ->t ('active ' ) : $ this ->t ('disabled ' ),
142
+ ]),
141
143
];
142
144
$ form ['messages ' ][$ key ]['trigger ' ] = [
143
145
'#type ' => 'select ' ,
144
- '#options ' => $ triggers ,
146
+ '#options ' => $ trigger_options ,
145
147
'#title ' => $ this ->t ('Trigger ' ),
146
148
'#default_value ' => $ message ['trigger ' ],
147
149
];
0 commit comments