Skip to content

Commit

Permalink
admin forms: add information icon for all the localized file types
Browse files Browse the repository at this point in the history
  • Loading branch information
vitek-rostislav committed Sep 2, 2024
1 parent b927a93 commit f228cdf
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 49 deletions.
4 changes: 4 additions & 0 deletions src/Form/Admin/UploadedFile/UploadedFileFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$builder->add('names', LocalizedType::class, [
'required' => false,
'label' => t('Names'),
'attr' => [
'icon' => true,
'iconTitle' => t('Name in the corresponding locale must be filled-in in order to display the file on the storefront'),
],
'entry_options' => [
'required' => false,
'constraints' => [
Expand Down
5 changes: 5 additions & 0 deletions src/Form/MultiLocaleBasicFileUploadType.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'entry_type' => LocalizedType::class,
'allow_add' => true,
'entry_options' => [
'attr' => [
'icon' => true,
'iconTitle' => t('Name in the corresponding locale must be filled-in in order to display the file on the storefront'),
'iconPlacement' => 'right',
],
'label' => '',
'entry_options' => [
'constraints' => [
Expand Down
75 changes: 26 additions & 49 deletions src/Form/MultiLocaleFileUploadType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,36 @@ class MultiLocaleFileUploadType extends AbstractType
* @param \Symfony\Component\Form\FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add($builder->create('namesIndexedById', CollectionType::class, [
'required' => false,
'entry_type' => LocalizedType::class,
'allow_add' => true,
$namesOptions = [
'required' => false,
'entry_type' => LocalizedType::class,
'allow_add' => true,
'entry_options' => [
'label' => '',
'attr' => [
'icon' => true,
'iconTitle' => t(
'Name in the corresponding locale must be filled-in in order to display the file on the storefront',
),
'iconPlacement' => 'right',
],
'entry_options' => [
'label' => '',
'entry_options' => [
'constraints' => [
new Constraints\Length([
'max' => 255,
'maxMessage' => 'Name cannot be longer than {{ limit }} characters',
]),
],
'constraints' => [
new Constraints\Length([
'max' => 255,
'maxMessage' => 'Name cannot be longer than {{ limit }} characters',
]),
],
],
]))->add(
$builder->create('names', CollectionType::class, [
'required' => false,
'entry_type' => LocalizedType::class,
'allow_add' => true,
'entry_options' => [
'label' => '',
'entry_options' => [
'constraints' => [
new Constraints\Length([
'max' => 255,
'maxMessage' => 'Name cannot be longer than {{ limit }} characters',
]),
],
],
],
]),
)->add(
$builder->create('relationsNames', CollectionType::class, [
'required' => false,
'entry_type' => LocalizedType::class,
'allow_add' => true,
'entry_options' => [
'label' => '',
'entry_options' => [
'constraints' => [
new Constraints\Length([
'max' => 255,
'maxMessage' => 'Name cannot be longer than {{ limit }} characters',
]),
],
],
],
]),
);
],
];

$builder
->add($builder->create('namesIndexedById', CollectionType::class, $namesOptions))
->add($builder->create('names', CollectionType::class, $namesOptions))
->add($builder->create('relationsNames', CollectionType::class, $namesOptions));
}

public function getParent()
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/translations/messages.cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -2143,6 +2143,9 @@ msgstr "Název"
msgid "Name %locale%"
msgstr "Název %locale%"

msgid "Name in the corresponding locale must be filled-in in order to display the file on the storefront"
msgstr "Pro zobrazení souboru na doméně musí být vyplněn název v odpovídajícím jazyce"

msgid "Name serves only for internal use within the administration"
msgstr "Název slouží pouze pro interní použití v rámci administrace"

Expand Down
3 changes: 3 additions & 0 deletions src/Resources/translations/messages.en.po
Original file line number Diff line number Diff line change
Expand Up @@ -2143,6 +2143,9 @@ msgstr ""
msgid "Name %locale%"
msgstr ""

msgid "Name in the corresponding locale must be filled-in in order to display the file on the storefront"
msgstr ""

msgid "Name serves only for internal use within the administration"
msgstr ""

Expand Down

0 comments on commit f228cdf

Please sign in to comment.