Skip to content

Commit

Permalink
Merge pull request #12 from nucleos/form-translation
Browse files Browse the repository at this point in the history
Set translation domain for whole form
  • Loading branch information
core23 committed Feb 7, 2020
2 parents 7b1faf9 + 412a267 commit e612edc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
7 changes: 3 additions & 4 deletions src/Form/Type/ProfileFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
$builder
->add('locale', LocaleType::class, [
'label' => 'form.locale',
'translation_domain' => 'NucleosProfileBundle',
'required' => false,
])
->add('timezone', TimezoneType::class, [
'label' => 'form.timezone',
'translation_domain' => 'NucleosProfileBundle',
'required' => false,
])
;
Expand All @@ -54,8 +52,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => $this->class,
'csrf_token_id' => 'profile',
'data_class' => $this->class,
'csrf_token_id' => 'profile',
'translation_domain' => 'NucleosProfileBundle',
]);
}
}
8 changes: 3 additions & 5 deletions src/Form/Type/RegistrationFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,13 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
$builder
->add('email', EmailType::class, [
'label' => 'form.email',
'translation_domain' => 'NucleosProfileBundle',
])
->add('username', TextType::class, [
'label' => 'form.username',
'translation_domain' => 'NucleosProfileBundle',
])
->add('plainPassword', RepeatedType::class, [
'type' => PasswordType::class,
'options' => [
'translation_domain' => 'NucleosProfileBundle',
'attr' => [
'autocomplete' => 'new-password',
],
Expand All @@ -66,8 +63,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => $this->class,
'csrf_token_id' => 'registration',
'data_class' => $this->class,
'csrf_token_id' => 'registration',
'translation_domain' => 'NucleosProfileBundle',
]);
}
}

0 comments on commit e612edc

Please sign in to comment.