diff --git a/public/modules/custom/grants_handler/src/Controller/AtvPrintViewController.php b/public/modules/custom/grants_handler/src/Controller/AtvPrintViewController.php index be3b46fc3b..c61997f732 100644 --- a/public/modules/custom/grants_handler/src/Controller/AtvPrintViewController.php +++ b/public/modules/custom/grants_handler/src/Controller/AtvPrintViewController.php @@ -89,7 +89,12 @@ public function __invoke(string $submission_id): array { } } - // Sort the fields based on weight. + // Sort the sections inside a page based on section weight. + foreach ($newPages as $pageKey => $page) { + usort($newPages[$pageKey]['sections'], fn($a, $b) => $a['weight'] > $b['weight']); + } + + // Sort the fields inside the sections based on weight. foreach ($newPages as $pageKey => $page) { foreach ($page['sections'] as $sectionKey => $section) { usort($newPages[$pageKey]['sections'][$sectionKey]['fields'], function ($fieldA, $fieldB) { diff --git a/public/modules/custom/grants_metadata/src/AtvSchema.php b/public/modules/custom/grants_metadata/src/AtvSchema.php index 6c5614a487..3acde835c6 100644 --- a/public/modules/custom/grants_metadata/src/AtvSchema.php +++ b/public/modules/custom/grants_metadata/src/AtvSchema.php @@ -371,12 +371,14 @@ private static function extractValuesRecursively(array $items, array $keys, arra if (in_array($key, $keys) && !in_array($key, $values)) { $values[$key] = $item; } - if (is_numeric($key) && - !AtvSchema::numericKeys($item) && - isset($item['ID']) && - in_array($item['ID'], $keys) && - !in_array($item['ID'], $values)) { - $values[$item['ID']] = $item['value']; + if ( + is_numeric($key) && + !AtvSchema::numericKeys($item) && + isset($item['ID']) && + in_array($item['ID'], $keys) && + !in_array($item['ID'], $values) + ) { + $values[$item['ID']] = htmlspecialchars_decode($item['value']); } } } diff --git a/public/modules/custom/grants_metadata/src/DocumentValueExtractor.php b/public/modules/custom/grants_metadata/src/DocumentValueExtractor.php index 898a12bddc..eabd741761 100644 --- a/public/modules/custom/grants_metadata/src/DocumentValueExtractor.php +++ b/public/modules/custom/grants_metadata/src/DocumentValueExtractor.php @@ -155,10 +155,12 @@ protected static function getArrayElementItemValue( $itemValue = self::processNestedArrayItem($v, $itemPropertyDefinitions); if (array_key_exists('value', $v)) { $meta = isset($v['meta']) ? json_decode($v['meta'], TRUE) : NULL; - $retval[$key][$v['ID']] = InputmaskHandler::convertPossibleInputmaskValue( - $itemValue ?? $v['value'], - $meta ?? [] + $value = InputmaskHandler::convertPossibleInputmaskValue( + $itemValue ?? $v['value'], + $meta ?? [] ); + + $retval[$key][$v['ID']] = htmlspecialchars_decode($value); } else { $retval[$key][$key2] = $itemValue ?? $v; @@ -210,7 +212,7 @@ protected static function extractItemValue( if ($valueExtractorConfig) { $valueExtractorService = self::getDynamicService($valueExtractorConfig['service']); $method = $valueExtractorConfig['method']; - return $valueExtractorService->$method($item); + return htmlspecialchars_decode($valueExtractorService->$method($item)); } return NULL; } @@ -239,7 +241,7 @@ protected static function extractSimpleItemValue( if ($valueExtractorConfig) { $valueExtractorService = self::getDynamicService($valueExtractorConfig['service']); $method = $valueExtractorConfig['method']; - return $valueExtractorService->$method($item); + return htmlspecialchars_decode($valueExtractorService->$method($item)); } } return NULL; diff --git a/public/modules/custom/grants_premises/src/GrantsPremisesService.php b/public/modules/custom/grants_premises/src/GrantsPremisesService.php index 3a39e4b8aa..cfbd66470d 100644 --- a/public/modules/custom/grants_premises/src/GrantsPremisesService.php +++ b/public/modules/custom/grants_premises/src/GrantsPremisesService.php @@ -195,7 +195,7 @@ public function extractToWebformData(DataDefinitionInterface $definition, array $value2value = 0; } } - $temp[$value2['ID']] = $value2value; + $temp[$value2['ID']] = htmlspecialchars_decode($value2value); } $returnValueArray[$key] = $temp; }