| Q | A
| --- | ---
| Bug? | no
| New Feature? | yes
There is no feature like this.
I would like to have the possibility to add a new tab into the webspace settings for custom fields. Like the websites-logo or key colors or main configurations what change the whole website.
when you add a xml template path under your webspace xml like:
<configuration>app/resources/config/webspacenameConfig.xml</configuration>
In my opinion I would not add a path I would allow the properties tag of the template definition inside the Webspace.xml and show under Webspace Settings a tab Content. We can store this data inside cmf/<webspace_key> node. On the website a webspace variable or a twig extension could return this data. /cc @sulu/core-team
Hi @Quehnie, as the feature was not implemented, I'm curious about how you solved it. Can you maybe describe that ?
Thanks ! 馃憤
Hey @aubryfr in this case we created a snippet, which we added as default snippet for the webspace so we can load it with sulu_snippet_load_default. I think this is the best possible solution at the moment.
http://docs.sulu.io/en/latest/reference/twig-extensions/functions/sulu_snippet_load_default.html
This would really be a fantastic feature. Just add some content types as "settings" to the webspace.xml and get a new tab in the backoffice where you now can add data. <3
In sulu 2.0 you can extend the webspace panel with your custom implementation.
Maybe some docs to do this is missing but it's possible. Look here:
https://github.com/sulu/sulu/blob/master/src/Sulu/Bundle/WebsiteBundle/Admin/WebsiteAdmin.php#L92
You can create your Admin class with "Sulu extend admin" documentation and set parent
->setParent(PageAdmin::WEBSPACE_TABS_VIEW)
@plozmun Right, this should already be possible to build on your own, but this specific use case should be easier to implement :slightly_smiling_face:
@aubryfr @Quehnie
We had the same problem. And solved it like this.
{{ settings.companyName }} in any twig file and will get the company nameWe experienced that snippets and settings default snippets is somewhat confusing to customers.
I included a GIF:

@jordygroote Nice solution! Implementing a basic settings entity should even be possible without adding custom Javascript. The trick is to set a default for the id attribute of the form view to make Sulu load the entity from the server 馃檪
I just added an example for this here: https://github.com/sulu/sulu-demo/pull/88
Be aware that the example above implements a global application settings entity, not a webspace specific one. If you dont want to use a default snippet for webspace-specific settings, you could implement this in a similar way to the example. This would need at least the following adjustments:
Register the SettingsAdmin::TAB_VIEW as child of the PageAdmin::WEBSPACE_TABS_VIEW:
https://github.com/sulu/sulu/blob/dc4b04b77af71286cae13aad44d704a83e1755ee/src/Sulu/Bundle/CustomUrlBundle/Admin/CustomUrlAdmin.php#L87
Send the current webspace to the server when saving the entity:
https://github.com/sulu/sulu/blob/e17f5de2eed01ccec7e2c3c8a204ab4ae81db4b6/src/Sulu/Bundle/CustomUrlBundle/Admin/CustomUrlAdmin.php#L81
Load and modify the correct entity based on the webspace parameter in your SettingsController
Load the correct entity based on the current webspace in the SettingsTwigExtension:
https://github.com/sulu/sulu/blob/e17f5de2eed01ccec7e2c3c8a204ab4ae81db4b6/src/Sulu/Bundle/WebsiteBundle/Twig/Navigation/NavigationTwigExtension.php#L77
Thanks a lot for the answer, @jordygroote!
(I'm not working with this at all anymore, but @valentinwatel might be interested)
Most helpful comment
@plozmun Right, this should already be possible to build on your own, but this specific use case should be easier to implement :slightly_smiling_face: