Skip to content

use specific language_name in a ChildForm Collection #728

@ELtd

Description

@ELtd

Hello,

I use a specific form in two collections.
I don't want to have the same labels in the two.
We should be able to force the language name in the options of the collection.

Form A [
      Collection A1 [
            Form B
       ],
      Collection A2[
            Form B
       ]
]

To fix the problem :

'language_name' => $this->parent->getLanguageName(),

- 'language_name' => $this->parent->getLanguageName(),
+ 'language_name' => $this->getOption('language_name') ?: $this->parent->getLanguageName(),

Then this code works as expected :

$this->add('A1', 'collection',
        [
            'type' => 'form',
            'options' => [
                'class' => B::class,
                'language_name'=>'models.A1.B',
            ]
        ]);

Thank you for your package !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions