add placeholders for inputs

This commit is contained in:
Julie Lenaerts 2022-01-21 12:34:14 +01:00
parent 126bd1a4eb
commit ecae7dab44
3 changed files with 11 additions and 1 deletions

View File

@ -28,18 +28,21 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\RadioType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Contracts\Translation\TranslatorInterface;
final class PersonResourceType extends AbstractType
{
private ResourceKindRender $resourceKindRender;
private PersonRender $personRender;
private ThirdPartyRender $thirdPartyRender;
private TranslatorInterface $translator;
public function __construct(ResourceKindRender $resourceKindRender, PersonRender $personRender, ThirdPartyRender $thirdPartyRender)
public function __construct(ResourceKindRender $resourceKindRender, PersonRender $personRender, ThirdPartyRender $thirdPartyRender, TranslatorInterface $translator)
{
$this->resourceKindRender = $resourceKindRender;
$this->personRender = $personRender;
$this->thirdPartyRender = $thirdPartyRender;
$this->translator = $translator;
}
public function buildForm(FormBuilderInterface $builder, array $options)
@ -54,6 +57,7 @@ final class PersonResourceType extends AbstractType
$qb->where($qb->expr()->eq('pr.isActive', 'TRUE'));
return $qb;
},
'placeholder' => $this->translator->trans('Select a type'),
'choice_label' => function (PersonResourceKind $personResourceKind) {
$options = [];
return $this->resourceKindRender->renderString($personResourceKind, $options);
@ -62,6 +66,7 @@ final class PersonResourceType extends AbstractType
->add('person', EntityType::class, [
'label' => 'Usager',
'class' => Person::class,
'placeholder' => $this->translator->trans('Select a person'),
'required' => false,
'choice_label' => function (Person $person) {
$options = [];
@ -72,6 +77,7 @@ final class PersonResourceType extends AbstractType
'label' => 'Tiers',
'class' => ThirdParty::class,
'required' => false,
'placeholder' => $this->translator->trans('Select a thirdparty'),
'choice_label' => function (ThirdParty $thirdParty) {
$options = [];
return $this->thirdPartyRender->renderString($thirdParty, $options);

View File

@ -235,6 +235,10 @@ The resource has been successfully removed.: "La ressource a été supprimée."
List of resources: "Liste des ressources"
There are no available resources: "Il y aucun ressource"
no comment found: "Aucun commentaire"
Select a type: "Choisissez un type"
Select a person: "Choisissez un usager"
Select a thirdparty: "Choisissez un tiers"
# pickAPersonType
Pick a person: Choisir une personne