選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

27 行
741B

  1. <?php
  2. namespace App\Field;
  3. use A2lix\TranslationFormBundle\Form\Type\TranslationsType;
  4. use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
  6. final class TranslationField implements FieldInterface
  7. {
  8. use FieldTrait;
  9. public static function new(string $propertyName, ?string $label = null, $fieldsConfig = []): self
  10. {
  11. return (new self())
  12. ->setProperty($propertyName)
  13. ->setLabel($label)
  14. ->setFormType(TranslationsType::class)
  15. ->setFormTypeOptions(
  16. [
  17. 'default_locale' => '%locale%',
  18. 'fields' => $fieldsConfig,
  19. ]
  20. );
  21. }
  22. }