-
Notifications
You must be signed in to change notification settings - Fork 351
Exclude not implemented templates for workspace / theme #1278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
As mentioned yesterday, if I understand coorectly, I do not think that associating XML structures with Webspaces via. Twig templates associated with Themes is a good idea. The template should know to which webspaces it is related, it should not b inferred indirectly. It would be better imo to achieve this via a webspace whitelist in the XML structure: <template>
<webspace>sulu_io</webspace>
<webspace>foobar</webspace>
<!-- ... -->
</template> The abscence of any webspaces in the XML template would imply that it should be available in all webspaces. /cc @chirimoya @danrot |
@dantleech i have ask @chirimoya for that and he thinks that it should work automatically! |
@dantleech For me the templates are the more standalone part, so if we wouldn't make it automatic I would add this whitelist (or blacklist, I would offer both) to the webspace. But the automatic solution is fine for me. |
But this seems to me to be a very tenuous link. The association is implicit. Explicit support should be implemented first, and any "magic" should be secondary. Templates are not absolutely a required part of a structure (we could imagine that templates are determined by other means). So, using the template, could prove to be flawed in the future. In addition, "automatic" should mean "automatic configuration". The system should not be based on magic, but could use magic for configuration. Although I would not worry about such things at this stage. I do not, however, believe in magic. :) |
4fa0a73
to
2a26ea5
Compare
@@ -124,7 +120,7 @@ public function getWebspaceKey() | |||
*/ | |||
public function getUuid() | |||
{ | |||
return $this->getDocument()->getUuid(); | |||
return $this->getDocument()->getUuid($this->document); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this call cannot work before! the required argument $document
was not given ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure there is not just an incorrect type hint? I guess $this->getDocument()
is already returning $this->document
, so what's the point in passing it again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the method doesn't take an argument as you can see in https://github.com/sulu-io/sulu/blob/ca0f510f63386763564b99bafbfd45bad5e7a76d/src/Sulu/Bundle/ContentBundle/Document/BasePageDocument.php#L402
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ou your rigth ... i will fix it
Again, I don't see that this is a good thing as I understand it. Firstly, the current situation is not wrong imo. There is no relation between (stucture) templates and webspaces, it is OK in most cases that they show all (structure) templates in all webspaces. Secondly, a whitelist could be used to limit which templates are available in the webspace XML file. This is an incredibly simple solution to the problem and it gives the developer explicit control when they need it. The "magic" approach will confuse people. If I add a (structure) template I expect it to be listed. If I add a template with a "wrong" Twig template, I would not think that would affect if it would be listed. With this PR I would add a template and it would just "not be there" and I would have no idea for why. Or maybe I misunderstand.. |
The current situation is wrong for sure. If you have a multiple webspace setup you will have all the templates in both webspaces, and the content manager is able to choose some templates which might not be targeted at the current webspace. That's one of the biggest issues we currently have. For me it would also be ok to have some kind of |
Also, what would happen if you wanted to use the same structure in two webspaces but with different Twig templates? And yeah, I agree the whitelist would be in the webspace XML definition. It should say, I am the webspace, and these are my structure types (templates). If it is not defined then all templates would be available. |
With the webspace theme you have configured the structures already "pre-selected". So for me adding all implemented templates (structures) to the workspace is kind of redundant and error prone. Also in this case I would prefer convention of configuration. |
+1 |
10910eb
to
9c022ba
Compare
Hmm, I guess my objection about using the structure in two webspaces with different Twig templates is not justified, as the Twig tempate is already hard-coupled to the structure type template. I guess I will rest my case. However, I think this problem could be solved in a better way at a higher level. But we will see. +0. |
No, it is already (and will still be) possible to use the same structure in two different webspaces with different twig templates. Actually the LiipThemeBundle is doing that for us. |
@wachterjohannes This doesn't work, for all node related controller actions I get an error:
|
On Tue, Jun 30, 2015 at 12:45:08AM -0700, Daniel Rotter wrote:
It should probably now be adjusted to use the StructureMetadataFactory (sulu_content.structure.metadata_factory) to get
|
@danrot @dantleech this is fixed (= that was my fault! |
|
||
<service id="sulu.content.webspace_structure_provider" class="%sulu.content.webspace_structure_provider.class%"> | ||
<argument type="service" id="twig"/> | ||
<argument type="service" id="sulu.content.structure_manager"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this is deprecated. We shoud be using the structure.metadata_factory
or the document_manager
depending on the use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah but i have implemented this before and dont want to change that much!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dantleech btw, do all these classes have a deprecated annotation with a comment which class should be used instead?
a92d444
to
21535aa
Compare
It would be nice if you would use the |
f172765
to
409ed06
Compare
tasks:
informations: