Skip to content

[TwigBridge] allow null values in form helpers #39603

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
Dec 23, 2020
Merged
Changes from all commits
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
6 changes: 3 additions & 3 deletions src/Symfony/Bridge/Twig/Extension/FormExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function getFieldValue(FormView $view)
return $view->vars['value'];
}

public function getFieldLabel(FormView $view): string
public function getFieldLabel(FormView $view): ?string
{
return $this->createFieldTranslation(
$view->vars['label'],
Expand All @@ -120,7 +120,7 @@ public function getFieldLabel(FormView $view): string
);
}

public function getFieldHelp(FormView $view): string
public function getFieldHelp(FormView $view): ?string
{
return $this->createFieldTranslation(
$view->vars['help'],
Expand Down Expand Up @@ -164,7 +164,7 @@ private function createFieldChoicesList(iterable $choices, $translationDomain):
}
}

private function createFieldTranslation(?string $value, array $parameters, $domain): string
private function createFieldTranslation(?string $value, array $parameters, $domain): ?string
{
if (!$this->translator || !$value || false === $domain) {
return $value;
Expand Down