liip / LiipThemeBundle

Provides theming support for Symfony bundles
MIT License
290 stars 76 forks source link

Can't work overriding for symfony 4.3 templates/bundles #201

Closed Pasuvan closed 5 years ago

Pasuvan commented 5 years ago

Hi, already I put the question for Symfony portal, Please can you check that below link https://github.com/symfony/symfony/issues/33845

dpmR commented 5 years ago

I am facing the same problem. After digging into the code I think I found the root of the problem.

https://github.com/liip/LiipThemeBundle/blob/362394821ff8dcc90b06272e289e7dafe4dab52a/Locator/FileLocator.php#L134 => $name contains 'views/@BundleName' instead of '@Bundle' so it does not jump into locateBundleResource

Also in https://github.com/liip/LiipThemeBundle/blob/362394821ff8dcc90b06272e289e7dafe4dab52a/Locator/FileLocator.php#L167 the 'views/' part needs to be removed.

With this changes made I can set a new path_pattern which then works:

liip_theme:
  ...
  path_patterns:
    app_resource:
      - '%kernel.project_dir%/templates/themes/%%current_theme%%/%%template%%'
      - '%kernel.project_dir%/templates/themes/default/%%template%%'
    bundle_resource:
      - '%kernel.project_dir%/templates/themes/%%current_theme%%/bundles/%%bundle_name%%/%%template%%'
      - '%kernel.project_dir%/templates/themes/default/bundles/%%bundle_name%%/%%template%%'
Pasuvan commented 5 years ago

Thanks @dpmR it's worked