Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S2FRMS-40/S2FRMS-58 child select #111

Merged
merged 17 commits into from
Jul 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function mitidChildrenSelectAjax(array &$form, FormStateInterface

switch ($element['#type']) {
case 'os2forms_mitid_child_name':
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getName() : 'Navne- og adressebeskyttet';
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getName() : t('Name and address protected');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use StringTranslationTrait and $this->t (rather than t) if possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rimi-itk
generally agree, but I could not change it in the specified file - it's used as static function, therefore using $this is impossible.
Changed it in other places/files where possible.

please check again

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, @stanbellcom. One final comment: #111 (comment)

$response->addCommand(new ReplaceCommand('.js-form-type-os2forms-mitid-child-name', $element));
break;

Expand All @@ -69,47 +69,47 @@ public static function mitidChildrenSelectAjax(array &$form, FormStateInterface
break;

case 'os2forms_mitid_child_address':
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getAddress() : 'Navne- og adressebeskyttet';
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getAddress() : t('Name and address protected');
$response->addCommand(new ReplaceCommand('.js-form-type-os2forms-mitid-child-address', $element));
break;

case 'os2forms_mitid_child_apartment_nr':
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getApartmentNr() : 'Navne- og adressebeskyttet';
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getApartmentNr() : t('Name and address protected');
$response->addCommand(new ReplaceCommand('.js-form-type-os2forms-mitid-child-apartment-nr', $element));
break;

case 'os2forms_mitid_child_city':
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getCity() : 'Navne- og adressebeskyttet';
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getCity() : t('Name and address protected');
$response->addCommand(new ReplaceCommand('.js-form-type-os2forms-mitid-child-city', $element));
break;

case 'os2forms_mitid_child_coaddress':
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getCoName() : 'Navne- og adressebeskyttet';
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getCoName() : t('Name and address protected');
$response->addCommand(new ReplaceCommand('.js-form-type-os2forms-mitid-child-coaddress', $element));
break;

case 'os2forms_mitid_child_floor':
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getFloor() : 'Navne- og adressebeskyttet';
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getFloor() : t('Name and address protected');
$response->addCommand(new ReplaceCommand('.js-form-type-os2forms-mitid-child-floor', $element));
break;

case 'os2forms_mitid_child_house_nr':
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getHouseNr() : 'Navne- og adressebeskyttet';
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getHouseNr() : t('Name and address protected');
$response->addCommand(new ReplaceCommand('.js-form-type-os2forms-mitid-child-house-nr', $element));
break;

case 'os2forms_mitid_child_kommunekode':
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getMunicipalityCode() : 'Navne- og adressebeskyttet';
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getMunicipalityCode() : t('Name and address protected');
$response->addCommand(new ReplaceCommand('.js-form-type-os2forms-mitid-child-kommunekode', $element));
break;

case 'os2forms_mitid_child_postal_code':
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getPostalCode() : 'Navne- og adressebeskyttet';
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getPostalCode() : t('Name and address protected');
$response->addCommand(new ReplaceCommand('.js-form-type-os2forms-mitid-child-postal-code', $element));
break;

case 'os2forms_mitid_child_street':
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getStreet() : 'Navne- og adressebeskyttet';
$element['#value'] = !$cprLookupResult->isNameAddressProtected() ? $cprLookupResult->getStreet() : t('Name and address protected');
$response->addCommand(new ReplaceCommand('.js-form-type-os2forms-mitid-child-street', $element));
break;

Expand Down