Afform - Fix filling preset values during submit
authorColeman Watts <coleman@civicrm.org>
Tue, 2 Feb 2021 01:56:28 +0000 (20:56 -0500)
committerColeman Watts <coleman@civicrm.org>
Tue, 2 Feb 2021 15:12:32 +0000 (10:12 -0500)
At some point the `af-values` attribute got renamed `data` but the Submit api wasn't updated.

ext/afform/core/Civi/Api4/Action/Afform/Submit.php

index 54a36f49d132ad2aaaff3add119f8a05e041fc4d..1f6e3e754c27a21dbcf0ff22f092d5eccb8d1948 100644 (file)
@@ -25,9 +25,9 @@ class Submit extends AbstractProcessor {
       foreach ($this->values[$entityName] ?? [] as $values) {
         $entityValues[$entity['type']][$entityName][] = $values + ['fields' => []];
         // Predetermined values override submitted values
-        if (!empty($entity['af-values'])) {
+        if (!empty($entity['data'])) {
           foreach ($entityValues[$entity['type']][$entityName] as $index => $vals) {
-            $entityValues[$entity['type']][$entityName][$index]['fields'] = $entity['af-values'] + $vals['fields'];
+            $entityValues[$entity['type']][$entityName][$index]['fields'] = $entity['data'] + $vals['fields'];
           }
         }
       }