Skip to content
This repository has been archived by the owner on Dec 18, 2020. It is now read-only.

Cannot add my own custom theme #794

Open
sjoerdmaessen opened this issue Jan 20, 2017 · 6 comments
Open

Cannot add my own custom theme #794

sjoerdmaessen opened this issue Jan 20, 2017 · 6 comments

Comments

@sjoerdmaessen
Copy link

| 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:

  • sulu theme bundle
  • liip theme bundle
  • assetic-bundle (this was not mentioned anywhere but without I couldn't initialise the config like in the documentation example)

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
Copy link
Member

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
Copy link
Author

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

@wachterjohannes
Copy link
Member

@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
Copy link
Contributor

danrot commented Jan 25, 2017

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
Copy link

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
Copy link
Contributor

danrot commented Feb 27, 2017

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants