From a19735e76c1ef2e8073318dc4133b6f3c906ce23 Mon Sep 17 00:00:00 2001 From: Stanislav Kutasevits Date: Mon, 18 Sep 2023 18:22:22 +0300 Subject: [PATCH 1/4] OS-58 adding company elements --- .../src/Element/NemidCompanyApartmentNr.php | 67 +++++++++++++++++++ .../src/Element/NemidCompanyFloor.php | 67 +++++++++++++++++++ .../src/Element/NemidCompanyHouseNr.php | 67 +++++++++++++++++++ .../src/Element/NemidCompanyKommunekode.php | 67 +++++++++++++++++++ .../src/Element/NemidCompanyPostalCode.php | 67 +++++++++++++++++++ .../src/Element/NemidCompanyStreet.php | 67 +++++++++++++++++++ .../NemidCompanyApartmentNr.php | 29 ++++++++ .../WebformElement/NemidCompanyFloor.php | 29 ++++++++ .../WebformElement/NemidCompanyHouseNr.php | 29 ++++++++ .../NemidCompanyKommunekode.php | 29 ++++++++ .../WebformElement/NemidCompanyPostalCode.php | 29 ++++++++ .../WebformElement/NemidCompanyStreet.php | 29 ++++++++ 12 files changed, 576 insertions(+) create mode 100644 modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php create mode 100644 modules/os2forms_nemid/src/Element/NemidCompanyFloor.php create mode 100644 modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php create mode 100644 modules/os2forms_nemid/src/Element/NemidCompanyKommunekode.php create mode 100644 modules/os2forms_nemid/src/Element/NemidCompanyPostalCode.php create mode 100644 modules/os2forms_nemid/src/Element/NemidCompanyStreet.php create mode 100644 modules/os2forms_nemid/src/Plugin/WebformElement/NemidCompanyApartmentNr.php create mode 100644 modules/os2forms_nemid/src/Plugin/WebformElement/NemidCompanyFloor.php create mode 100644 modules/os2forms_nemid/src/Plugin/WebformElement/NemidCompanyHouseNr.php create mode 100644 modules/os2forms_nemid/src/Plugin/WebformElement/NemidCompanyKommunekode.php create mode 100644 modules/os2forms_nemid/src/Plugin/WebformElement/NemidCompanyPostalCode.php create mode 100644 modules/os2forms_nemid/src/Plugin/WebformElement/NemidCompanyStreet.php diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php b/modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php new file mode 100644 index 00000000..d38032fd --- /dev/null +++ b/modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php @@ -0,0 +1,67 @@ + [ + [$class, 'processNemidCompanyApartmentNr'], + [$class, 'processAjaxForm'], + ], + '#element_validate' => [ + [$class, 'validateNemidCompanyApartmentNr'], + ], + '#pre_render' => [ + [$class, 'preRenderNemidCompanyApartmentNr'], + ], + '#theme' => 'input__os2forms_nemid_company_apartment_nr', + ]; + } + + /** + * Processes a 'os2forms_nemid_company_apartment_nr' element. + */ + public static function processNemidCompanyApartmentNr(&$element, FormStateInterface $form_state, &$complete_form) { + // Here you can add and manipulate your element's properties and callbacks. + return $element; + } + + /** + * Webform element validation handler for #type 'os2forms_nemid_company_apartment_nr'. + */ + public static function validateNemidCompanyApartmentNr(&$element, FormStateInterface $form_state, &$complete_form) { + // Here you can add custom validation logic. + } + + /** + * {@inheritdoc} + */ + public static function preRenderNemidCompanyApartmentNr(array $element) { + $element = parent::prerenderNemidElementBase($element); + static::setAttributes($element, [ + 'form-text', + 'os2forms-nemid-company-apartment-nr', + ]); + return $element; + } + +} diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyFloor.php b/modules/os2forms_nemid/src/Element/NemidCompanyFloor.php new file mode 100644 index 00000000..c78a07de --- /dev/null +++ b/modules/os2forms_nemid/src/Element/NemidCompanyFloor.php @@ -0,0 +1,67 @@ + [ + [$class, 'processNemidCompanyFloor'], + [$class, 'processAjaxForm'], + ], + '#element_validate' => [ + [$class, 'validateNemidCompanyFloor'], + ], + '#pre_render' => [ + [$class, 'preRenderNemidCompanyFloor'], + ], + '#theme' => 'input__os2forms_nemid_company_floor', + ]; + } + + /** + * Processes a 'os2forms_nemid_company_floor' element. + */ + public static function processNemidCompanyFloor(&$element, FormStateInterface $form_state, &$complete_form) { + // Here you can add and manipulate your element's properties and callbacks. + return $element; + } + + /** + * Webform element validation handler for #type 'os2forms_nemid_company_floor'. + */ + public static function validateNemidCompanyFloor(&$element, FormStateInterface $form_state, &$complete_form) { + // Here you can add custom validation logic. + } + + /** + * {@inheritdoc} + */ + public static function preRenderNemidCompanyFloor(array $element) { + $element = parent::prerenderNemidElementBase($element); + static::setAttributes($element, [ + 'form-text', + 'os2forms-nemid-company-floor', + ]); + return $element; + } + +} diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php b/modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php new file mode 100644 index 00000000..a29437a9 --- /dev/null +++ b/modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php @@ -0,0 +1,67 @@ + [ + [$class, 'processNemidCompanyHouseNr'], + [$class, 'processAjaxForm'], + ], + '#element_validate' => [ + [$class, 'validateNemidCompanyHouseNr'], + ], + '#pre_render' => [ + [$class, 'preRenderNemidCompanyHouseNr'], + ], + '#theme' => 'input__os2forms_nemid_company_house_nr', + ]; + } + + /** + * Processes a 'os2forms_nemid_company_house_nr' element. + */ + public static function processNemidCompanyHouseNr(&$element, FormStateInterface $form_state, &$complete_form) { + // Here you can add and manipulate your element's properties and callbacks. + return $element; + } + + /** + * Webform element validation handler for #type 'os2forms_nemid_company_house_nr'. + */ + public static function validateNemidCompanyHouseNr(&$element, FormStateInterface $form_state, &$complete_form) { + // Here you can add custom validation logic. + } + + /** + * {@inheritdoc} + */ + public static function preRenderNemidCompanyHouseNr(array $element) { + $element = parent::prerenderNemidElementBase($element); + static::setAttributes($element, [ + 'form-text', + 'os2forms-nemid-company-house-nr', + ]); + return $element; + } + +} diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyKommunekode.php b/modules/os2forms_nemid/src/Element/NemidCompanyKommunekode.php new file mode 100644 index 00000000..156211d0 --- /dev/null +++ b/modules/os2forms_nemid/src/Element/NemidCompanyKommunekode.php @@ -0,0 +1,67 @@ + [ + [$class, 'processNemidCompanyKommunekode'], + [$class, 'processAjaxForm'], + ], + '#element_validate' => [ + [$class, 'validateNemidCompanyKommunekode'], + ], + '#pre_render' => [ + [$class, 'preRenderNemidCompanyKommunekode'], + ], + '#theme' => 'input__os2forms_nemid_company_kommunekode', + ]; + } + + /** + * Processes a 'os2forms_nemid_company_kommunekode' element. + */ + public static function processNemidCompanyKommunekode(&$element, FormStateInterface $form_state, &$complete_form) { + // Here you can add and manipulate your element's properties and callbacks. + return $element; + } + + /** + * Webform element validation handler for #type 'os2forms_nemid_company_kommunekode'. + */ + public static function validateNemidCompanyKommunekode(&$element, FormStateInterface $form_state, &$complete_form) { + // Here you can add custom validation logic. + } + + /** + * {@inheritdoc} + */ + public static function preRenderNemidCompanyKommunekode(array $element) { + $element = parent::prerenderNemidElementBase($element); + static::setAttributes($element, [ + 'form-text', + 'os2forms-nemid-company-kommunekode', + ]); + return $element; + } + +} diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyPostalCode.php b/modules/os2forms_nemid/src/Element/NemidCompanyPostalCode.php new file mode 100644 index 00000000..c60280b7 --- /dev/null +++ b/modules/os2forms_nemid/src/Element/NemidCompanyPostalCode.php @@ -0,0 +1,67 @@ + [ + [$class, 'processNemidCompanyPostalCode'], + [$class, 'processAjaxForm'], + ], + '#element_validate' => [ + [$class, 'validateNemidCompanyPostalCode'], + ], + '#pre_render' => [ + [$class, 'preRenderNemidCompanyPostalCode'], + ], + '#theme' => 'input__os2forms_nemid_company_postal_code', + ]; + } + + /** + * Processes a 'os2forms_nemid_company_postal_code' element. + */ + public static function processNemidCompanyPostalCode(&$element, FormStateInterface $form_state, &$complete_form) { + // Here you can add and manipulate your element's properties and callbacks. + return $element; + } + + /** + * Webform element validation handler for #type 'os2forms_nemid_company_postal_code'. + */ + public static function validateNemidCompanyPostalCode(&$element, FormStateInterface $form_state, &$complete_form) { + // Here you can add custom validation logic. + } + + /** + * {@inheritdoc} + */ + public static function preRenderNemidCompanyPostalCode(array $element) { + $element = parent::prerenderNemidElementBase($element); + static::setAttributes($element, [ + 'form-text', + 'os2forms-nemid-company-postal-code', + ]); + return $element; + } + +} diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyStreet.php b/modules/os2forms_nemid/src/Element/NemidCompanyStreet.php new file mode 100644 index 00000000..7bcc9ed0 --- /dev/null +++ b/modules/os2forms_nemid/src/Element/NemidCompanyStreet.php @@ -0,0 +1,67 @@ + [ + [$class, 'processNemidCompanyStreet'], + [$class, 'processAjaxForm'], + ], + '#element_validate' => [ + [$class, 'validateNemidCompanyStreet'], + ], + '#pre_render' => [ + [$class, 'preRenderNemidCompanyStreet'], + ], + '#theme' => 'input__os2forms_nemid_company_street', + ]; + } + + /** + * Processes a 'os2forms_nemid_company_street' element. + */ + public static function processNemidCompanyStreet(&$element, FormStateInterface $form_state, &$complete_form) { + // Here you can add and manipulate your element's properties and callbacks. + return $element; + } + + /** + * Webform element validation handler for #type 'os2forms_nemid_company_street'. + */ + public static function validateNemidCompanyStreet(&$element, FormStateInterface $form_state, &$complete_form) { + // Here you can add custom validation logic. + } + + /** + * {@inheritdoc} + */ + public static function preRenderNemidCompanyStreet(array $element) { + $element = parent::prerenderNemidElementBase($element); + static::setAttributes($element, [ + 'form-text', + 'os2forms-nemid-company-street', + ]); + return $element; + } + +} diff --git a/modules/os2forms_nemid/src/Plugin/WebformElement/NemidCompanyApartmentNr.php b/modules/os2forms_nemid/src/Plugin/WebformElement/NemidCompanyApartmentNr.php new file mode 100644 index 00000000..c8da2fb7 --- /dev/null +++ b/modules/os2forms_nemid/src/Plugin/WebformElement/NemidCompanyApartmentNr.php @@ -0,0 +1,29 @@ + Date: Mon, 18 Sep 2023 18:30:15 +0300 Subject: [PATCH 2/4] OS-58 Fixing phpcs --- CHANGELOG.md | 2 ++ modules/os2forms_nemid/src/Element/NemidCompanyFloor.php | 2 +- modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php | 2 +- modules/os2forms_nemid/src/Element/NemidCompanyKommunekode.php | 2 +- modules/os2forms_nemid/src/Element/NemidCompanyPostalCode.php | 2 +- modules/os2forms_nemid/src/Element/NemidCompanyStreet.php | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3df67288..ca989385 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ before starting to add changes. Use example [placed in the end of the page](#exa ## [Unreleased] +- [OS-58] New company address fields + ## [3.10.0] 2023-08-23 - [OSF-55] DAWA Address-Matrikula (autocomplete) (required) diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyFloor.php b/modules/os2forms_nemid/src/Element/NemidCompanyFloor.php index c78a07de..5b69c140 100644 --- a/modules/os2forms_nemid/src/Element/NemidCompanyFloor.php +++ b/modules/os2forms_nemid/src/Element/NemidCompanyFloor.php @@ -46,7 +46,7 @@ public static function processNemidCompanyFloor(&$element, FormStateInterface $f } /** - * Webform element validation handler for #type 'os2forms_nemid_company_floor'. + * Webform element validation handler for 'os2forms_nemid_company_floor'. */ public static function validateNemidCompanyFloor(&$element, FormStateInterface $form_state, &$complete_form) { // Here you can add custom validation logic. diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php b/modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php index a29437a9..f8bc2412 100644 --- a/modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php +++ b/modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php @@ -46,7 +46,7 @@ public static function processNemidCompanyHouseNr(&$element, FormStateInterface } /** - * Webform element validation handler for #type 'os2forms_nemid_company_house_nr'. + * Webform element validation handler for 'os2forms_nemid_company_house_nr'. */ public static function validateNemidCompanyHouseNr(&$element, FormStateInterface $form_state, &$complete_form) { // Here you can add custom validation logic. diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyKommunekode.php b/modules/os2forms_nemid/src/Element/NemidCompanyKommunekode.php index 156211d0..3a763478 100644 --- a/modules/os2forms_nemid/src/Element/NemidCompanyKommunekode.php +++ b/modules/os2forms_nemid/src/Element/NemidCompanyKommunekode.php @@ -46,7 +46,7 @@ public static function processNemidCompanyKommunekode(&$element, FormStateInterf } /** - * Webform element validation handler for #type 'os2forms_nemid_company_kommunekode'. + * Webform element validation for 'os2forms_nemid_company_kommunekode'. */ public static function validateNemidCompanyKommunekode(&$element, FormStateInterface $form_state, &$complete_form) { // Here you can add custom validation logic. diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyPostalCode.php b/modules/os2forms_nemid/src/Element/NemidCompanyPostalCode.php index c60280b7..bfe34437 100644 --- a/modules/os2forms_nemid/src/Element/NemidCompanyPostalCode.php +++ b/modules/os2forms_nemid/src/Element/NemidCompanyPostalCode.php @@ -46,7 +46,7 @@ public static function processNemidCompanyPostalCode(&$element, FormStateInterfa } /** - * Webform element validation handler for #type 'os2forms_nemid_company_postal_code'. + * Webform element validation for 'os2forms_nemid_company_postal_code'. */ public static function validateNemidCompanyPostalCode(&$element, FormStateInterface $form_state, &$complete_form) { // Here you can add custom validation logic. diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyStreet.php b/modules/os2forms_nemid/src/Element/NemidCompanyStreet.php index 7bcc9ed0..ae995a17 100644 --- a/modules/os2forms_nemid/src/Element/NemidCompanyStreet.php +++ b/modules/os2forms_nemid/src/Element/NemidCompanyStreet.php @@ -46,7 +46,7 @@ public static function processNemidCompanyStreet(&$element, FormStateInterface $ } /** - * Webform element validation handler for #type 'os2forms_nemid_company_street'. + * Webform element validation handler for 'os2forms_nemid_company_street'. */ public static function validateNemidCompanyStreet(&$element, FormStateInterface $form_state, &$complete_form) { // Here you can add custom validation logic. From c6f8aa2f127559b2b9136a086be0fa8f8cfa9b8d Mon Sep 17 00:00:00 2001 From: Stanislav Kutasevits Date: Mon, 18 Sep 2023 18:32:53 +0300 Subject: [PATCH 3/4] OS-58 Fixing phpcs --- modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php b/modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php index d38032fd..487c7dd9 100644 --- a/modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php +++ b/modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php @@ -46,7 +46,7 @@ public static function processNemidCompanyApartmentNr(&$element, FormStateInterf } /** - * Webform element validation handler for #type 'os2forms_nemid_company_apartment_nr'. + * Webform element validation for 'os2forms_nemid_company_apartment_nr'. */ public static function validateNemidCompanyApartmentNr(&$element, FormStateInterface $form_state, &$complete_form) { // Here you can add custom validation logic. From ad19d3876c3ec4265df8fedc0212c7ca5734a36b Mon Sep 17 00:00:00 2001 From: Stanislav Kutasevits Date: Tue, 19 Sep 2023 10:43:46 +0300 Subject: [PATCH 4/4] OS-58 fixing naming --- .../os2forms_nemid/src/Element/NemidCompanyApartmentNr.php | 4 ++-- modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php b/modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php index 487c7dd9..830f68ad 100644 --- a/modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php +++ b/modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php @@ -5,9 +5,9 @@ use Drupal\Core\Form\FormStateInterface; /** - * Provides a 'os2forms_nemid_company_street'. + * Provides a 'os2forms_nemid_company_apartment_nr'. * - * @FormElement("os2forms_nemid_company_street") + * @FormElement("os2forms_nemid_company_apartment_nr") * * @see \Drupal\Core\Render\Element\FormElement * @see https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21Element%21FormElement.php/class/FormElement diff --git a/modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php b/modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php index f8bc2412..7122441f 100644 --- a/modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php +++ b/modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php @@ -5,7 +5,7 @@ use Drupal\Core\Form\FormStateInterface; /** - * Provides a 'os2forms_nemid_company_street'. + * Provides a 'os2forms_nemid_company_house_nr'. * * @FormElement("os2forms_nemid_company_house_nr") *