|
7 | 7 | use Drupal\Core\Ajax\AjaxResponse; |
8 | 8 | use Drupal\Core\Ajax\ReplaceCommand; |
9 | 9 | use Drupal\Core\Entity\EntityForm; |
| 10 | +use Drupal\Core\Entity\EntityInterface; |
10 | 11 | use Drupal\Core\Entity\EntityTypeInterface; |
11 | 12 | use Drupal\Core\Form\FormStateInterface; |
12 | 13 | use Drupal\Core\Form\SubformState; |
@@ -243,6 +244,19 @@ public function form(array $form, FormStateInterface $formState): array { |
243 | 244 | return $form; |
244 | 245 | } |
245 | 246 |
|
| 247 | + /** |
| 248 | + * {@inheritdoc} |
| 249 | + */ |
| 250 | + protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state): void { |
| 251 | + // Translate the debug flag from individual checkboxes to the enum value |
| 252 | + // that the GraphQL library expects. |
| 253 | + $debug_flag = $form_state->getValue('debug_flag'); |
| 254 | + if (is_array($debug_flag)) { |
| 255 | + $form_state->setValue('debug_flag', array_sum($debug_flag)); |
| 256 | + } |
| 257 | + parent::copyFormValuesToEntity($entity, $form, $form_state); |
| 258 | + } |
| 259 | + |
246 | 260 | /** |
247 | 261 | * {@inheritdoc} |
248 | 262 | * |
@@ -274,9 +288,6 @@ public function validateForm(array &$form, FormStateInterface $formState): void |
274 | 288 | * {@inheritdoc} |
275 | 289 | */ |
276 | 290 | public function submitForm(array &$form, FormStateInterface $formState): void { |
277 | | - // Translate the debug flag from individual checkboxes to the enum value |
278 | | - // that the GraphQL library expects. |
279 | | - $formState->setValue('debug_flag', array_sum($formState->getValue('debug_flag'))); |
280 | 291 | parent::submitForm($form, $formState); |
281 | 292 |
|
282 | 293 | $schema = $formState->getValue('schema'); |
|
0 commit comments