Finally i got a way to solve this issue.
I found solution from below link:
https://github.com/EasyCorp/EasyAdminBundle/issues/1621
Created a translation field:
namespace AppAdminField;
use A2lixTranslationFormBundleFormTypeTranslationsType;
use EasyCorpBundleEasyAdminBundleContractsFieldFieldInterface;
use EasyCorpBundleEasyAdminBundleFieldFieldTrait;
final class TranslationField implements FieldInterface
{
use FieldTrait;
public static function new(string $propertyName, ?string $label = null, $fieldsConfig = []): self
{
return (new self())
->setProperty($propertyName)
->setLabel($label)
->setFormType(TranslationsType::class)
->setFormTypeOptions(
[
'default_locale' => '%locale%',
'fields' => $fieldsConfig,
]
);
}
}
After creating field implement in crud controller:
public function configureFields(string $pageName): iterable
{
$fieldsConfig = [
'subject' => [
'field_type' => TextareaType::class,
'required' => true,
'label' => 'Тема',
],
'text' => [
'field_type' => CKEditorType::class,
'required' => true,
'label' => 'Текст',
],
];
return [
TranslationField::new('translations', 'Переводы', $fieldsConfig)
->setRequired(true)
->hideOnIndex(),
TextField::new('subject')->hideOnForm()->setLabel('Тема'),
BooleanField::new('isActive')->setLabel('Активность'),
];
}
This code will save time of anybody who face this kind of issue.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…