Skip to content

[Form] check parent types for label_format and translation_domain #39951

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

Merged
merged 1 commit into from
Jan 24, 2021

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Jan 23, 2021

Q A
Branch? 5.2
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #39874
License MIT
Doc PR


do {
$translationDomain = $form->getConfig()->getOption('translation_domain');
} while (null === $translationDomain && null !== $form = $form->getParent());
Copy link

Choose a reason for hiding this comment

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

nit-pick: The loop is a duplicate of the above one. Introduce a private function?

private function getOption($form, $optionLabel) {
  do {
    $option = $form->getConfig()->getOption($optionLabel);
  } while (null === $option && null !== $form = $form->getParent());

  return $option;
}

@xabbuh xabbuh merged commit c38473a into symfony:5.2 Jan 24, 2021
@xabbuh xabbuh deleted the issue-39874 branch January 24, 2021 20:09
@fabpot fabpot mentioned this pull request Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants