EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

setTemplatePath not working with generic (Field::New('...')) EasyCorp\Bundle\EasyAdminBundle\Field\Field

Open kadiiski opened this issue 3 years ago • 0 comments

Describe the bug

As following the course on symfony casts - https://symfonycasts.com/screencast/easyadminbundle/field-template

I have an entity that has an integer field "vodes". Created a template override for it, but it's not working untill I change it to "IntegerField".

public function configureFields(string $pageName): iterable { yield Field::new('votes') ->setTemplatePath('admin/field/votes.html.twig'); }

To Reproduce

  1. Create a crud for entity with integer field (maybe others might behave the same way as well).
  2. In the crud controller for this field try to override the template for the field, but use the generic EasyCorp\Bundle\EasyAdminBundle\Field\Field
  3. Nothing happens.

Versions: PHP 8.0.22

"require": { "php": ">=8.0.2", "ext-ctype": "", "ext-iconv": "", "composer/package-versions-deprecated": "^1.11", "doctrine/doctrine-bundle": "^2.1", "doctrine/doctrine-migrations-bundle": "^3.0", "doctrine/orm": "^2.7", "easycorp/easyadmin-bundle": "^4.4", "knplabs/knp-markdown-bundle": "dev-symfony6", "knplabs/knp-time-bundle": "^1.11", "sensio/framework-extra-bundle": "^6.0", "stof/doctrine-extensions-bundle": "^1.4", "symfony/asset": "6.0.", "symfony/console": "6.0.", "symfony/dotenv": "6.0.", "symfony/flex": "^2.0.0", "symfony/framework-bundle": "6.0.", "symfony/mime": "6.0.", "symfony/monolog-bundle": "^3.0", "symfony/runtime": "6.0.", "symfony/security-bundle": "6.0.", "symfony/stopwatch": "6.0.", "symfony/twig-bundle": "6.0.", "symfony/webpack-encore-bundle": "^1.7", "symfony/yaml": "6.0.", "twig/extra-bundle": "^2.12|^3.0", "twig/twig": "^2.12|^3.0" }, "require-dev": { "doctrine/doctrine-fixtures-bundle": "^3.3", "symfony/debug-bundle": "6.0.", "symfony/maker-bundle": "^1.15", "symfony/var-dumper": "6.0.", "symfony/web-profiler-bundle": "6.0.*", "zenstruck/foundry": "^1.1" },

If this was expected behaviour - maybe it might be a nice idea to not have it as an option for the Field.

kadiiski avatar Dec 10 '22 07:12 kadiiski