diff --git a/CHANGELOG.md b/CHANGELOG.md index d8162bfb..8b93e9c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ before starting to add changes. Use example [placed in the end of the page](#exa ## [Unreleased] +## [3.13.1] 2023-10-19 + +- Checking CPR format before fetching data + ## [3.13.0] 2023-10-11 - [#62](https://github.com/OS2Forms/os2forms/pull/62) diff --git a/modules/os2forms_nemid/src/Element/NemidCprFetchData.php b/modules/os2forms_nemid/src/Element/NemidCprFetchData.php index 1dc01d27..5c20fbb8 100644 --- a/modules/os2forms_nemid/src/Element/NemidCprFetchData.php +++ b/modules/os2forms_nemid/src/Element/NemidCprFetchData.php @@ -9,6 +9,18 @@ */ class NemidCprFetchData extends CompositeFetchDataBase { + /** + * {@inheritdoc} + */ + public static function getCompositeElements(array $element) { + $elements = parent::getCompositeElements($element); + + // Pattern for CPR. + $elements[self::getValueElementName()]['#pattern'] = '\d{6}-\d{4}'; + + return $elements; + } + /** * {@inheritdoc} */