sulu / SuluThemeBundle

MIT License
18 stars 15 forks source link

Webspace Validation shows "Unable to find template ..." #30

Open brachycera opened 2 years ago

brachycera commented 2 years ago
Q A
Bug? Yes?!
New Feature? no
Bundle Version 3.0
Sulu Version 2.4.3.
Browser Version Browser name and version

Actual Behavior

Create a Theme with the folder structure

-- config --- templates ---- pages ----- foo.xml

-- templates --- pages ---- foo.twig.html

-- themes --- foo_theme --- theme.json ---- pages ------ foo.twig.html

Expected Behavior

The Webspace validation shows no errors:

php bin/adminconsole sulu:content:validate:webspaces

The SylusTheme list command shows the correct theme "foo_theme":

php bin/adminconsole sylius:theme:list

Steps to Reproduce

Now remove the foo template from templates/pages/foo.twig.html

The Website works without errors and uses the expected template file themes/foo_theme/pages/foo.twig.html.

But the Webspace validation now shows an error:

Page Templates:
    page: foo -> failed: Unable to find templates "pages/foo.html.twig".

Is this the expected behavior and must I keep both templates templates/pages/foo.twig.html and themes/foo_theme/pages/foo.twig.html in place even when I use the SuluTheme package?

alexander-schranz commented 2 years ago

@brachycera Thx for creating the issue. The sulu:content:validate:webspaces only knows about the default templates and know nothing about the sylius themes.

The problem here is the sulu:content command lives in the sulu/sulu package and should not know about themes and so fails in this case.

We would then need a requirement of themes in sulu core which we currently wanted to avoid. There was already a PR for it https://github.com/sulu/sulu/pull/5806, which did not get merged because of dependency issue.

The only solution I see would be we add a interface for checking the existing of templates in the sulu core, the core behave like currently. And in SuluThemeBundle we override that service to keep the themes in mind.

brachycera commented 2 years ago

Hey @alexander-schranz, many thanks for you answer! I was already suspecting that sulu/sulu had no knowledge that the SuluThemePackage is installed. My concern was - that I have to keep the template files in sync in two places themes/foo_theme/... and templates/.... But since the error is a false negative I guess I don't have to do that :wink:

alexander-schranz commented 2 years ago

Yeah the error is a false negative. I will still keep the issue open so we maybe can tackle it one day.