Easyadminbundle: Custom directory for overriding the templates by convention

Created on 15 Jun 2017  路  10Comments  路  Source: EasyCorp/EasyAdminBundle

I want to set %kernel.project_dir%/templates instead of %kernel.root_dir%/Resources/views for the projects with Symfony Flex. What about a new configuration?

easy_admin:
    design:
        templates_dir: '%kernel.project_dir%/templates'
bug confirmed hasPR

All 10 comments

twig:
    paths:
        - '%kernel.project_dir%/templates'

?

@hason really. As we have $backendConfig variable in this method, i guess path can be configurable.

@yceruto TemplateConfigPass.php don't use twig paths to Overriding the Default Templates By Convention. I guess here is the problem

Now after this https://github.com/javiereguiluz/EasyAdminBundle/commit/3d83921a2f106d23423437014b6c8349851b760e is possible to modify the main template directory overriding the %easyadmin.templates_dir% parameter.

Even though there is a workaround out-of-the-box in play for all bundles https://stackoverflow.com/a/45220468/4224384 ;)

Even if this can be solved by 3d83921 I think this is a bug (and "easy" to solve it) so I'm reopening this and I'll submit a PR soon.

The real problem is that in the past we looked for the templates using hardcoded file paths and file_exists() calls. But the right way to look for templates is to use relative/logical template paths and ask Twig if the template exists. I'm trying to do that in #1748.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

devkbsc picture devkbsc  路  3Comments

ndench picture ndench  路  4Comments

Ealenn picture Ealenn  路  3Comments

SirMishaa picture SirMishaa  路  3Comments

javiereguiluz picture javiereguiluz  路  4Comments