sulu / sulu-standard

This repository is not longer the recommended way to start a sulu project. Use:
https://github.com/sulu/skeleton
MIT License
613 stars 106 forks source link

Cannot add my own custom theme #794

Open sjoerdmaessen opened 7 years ago

sjoerdmaessen commented 7 years ago

| Bug? | yes | Sulu Version | 1.4

Actual Behavior

After following the documentatie on how to add a theme: http://docs.sulu.io/en/latest/book/themes.html

I get a XML parse error: InvalidWebspaceException in XmlFileLoader10.php line 148: Could not parse webspace XML file "/vagrant/website/app/Resources/webspaces/myownsite.com.xml"

Expected Behavior

No parse error but the ability to see my custom theme as an active theme

Steps to Reproduce

Download and install the latest edition of SULU, install the following bundles according the documentation:

Create a custom theme folder in src/WebsiteBundle/Resources/themes/nameoftheme

Try to register the theme by editing the webspace XML file, myownsite.com.xml in my case for testing purposes. Now refresh the browser to see the parse error.

wachterjohannes commented 7 years ago

the problem seems that the xsd requires exact position of the node see screenshot:

image

Maybe we could make that xsd more fault tolerant

sjoerdmaessen commented 7 years ago

I can confirm that after placing the key between localizations and default-templates the error disappears.

wachterjohannes commented 7 years ago

@danrot what do you think? should we change it to a more logical order? or we make the order unrelevant. see following diff

diff --git a/src/Sulu/Component/Webspace/Loader/schema/webspace/webspace-1.1.xsd b/src/Sulu/Component/Webspace/Loader/schema/webspace/webspace-1.1.xsd
index f5355cc8e..d6fa4ae4f 100644
--- a/src/Sulu/Component/Webspace/Loader/schema/webspace/webspace-1.1.xsd
+++ b/src/Sulu/Component/Webspace/Loader/schema/webspace/webspace-1.1.xsd
@@ -4,7 +4,7 @@
            xmlns:webspace="http://schemas.sulu.io/webspace/webspace"
            xmlns="http://schemas.sulu.io/webspace/webspace">
     <xs:complexType name="webspaceType">
-        <xs:sequence>
+        <xs:all>
             <xs:element type="xs:string" name="name"/>
             <xs:element name="key">
                 <xs:simpleType>
@@ -22,7 +22,7 @@
             <xs:element type="navigationType" name="navigation"/>
             <xs:element type="resource-locatorType" name="resource-locator" maxOccurs="1" minOccurs="0"/>
             <xs:element type="portalsType" name="portals"/>
-        </xs:sequence>
+        </xs:all>
     </xs:complexType>

     <xs:complexType name="security">
danrot commented 7 years ago

Don't think that more logical means the same to everybody. I also don't think that there is a reason we have to have that in a certain order. So I would say we make the order arbitrary.

matt-halliday commented 7 years ago

I had the same issue in v1.4.7. The error has gone away as above - by fixing the order of things - however the custom theme is not being picked up/used. It's just using the default theme/templates. Not sure if there's a step missing in the documentation or an issue here.

If I specify a template in the webspace and config.yml and remove all reference to default, there's no error even if the specified template directory doesn't exist.

Let me know if you need more information to recreate the issue.

danrot commented 7 years ago

@matt-halliday Can you show the files being important here?