multisite-bundle icon indicating copy to clipboard operation
multisite-bundle copied to clipboard

Detection of plain hosts

Open elmariachi111 opened this issue 8 years ago • 0 comments

What I'm trying to achieve is to override templates for different host names only. My routes are mostly not defined in annotations but in configuration so I simply want to configure "if hostname matches xxx.yyy.zzz => switch the branding to x.y.z" and use overridden templates if you find any"

(my config:)

alex_multisite:
  default_branding: abc
  default_locale:   de_DE
  brandings:
    abc:
      de_DE: { host: www.abc.def }
    xyz:
      de_DE: { host: www.xyz.uvw }

if used like that (and no other configuration at all), I would assume that templates are located in subfolders like _xyz_ first before falling back to the defaults but when accessing the page "www.xyz.uvw" the branding remains "abc" which I didn't expect. After taking a deeper dive I wrote the code in this PR to work around the locales/annotations but the way I'm doing it here is definitely far from optimal. It does what I want to achieve but it breaks one test (Routing::testDefaultBehaviour) with "Unable to generate a URL for the named route "test_locale" as such route does not exist." Now, obviously that route does exist but the routing generator might have some issue with my custom override. I can't figure out how to fix that so any ideas would be greatly appreciated.

elmariachi111 avatar Jan 23 '17 13:01 elmariachi111