-
Notifications
You must be signed in to change notification settings - Fork 48
Home link #15
Comments
Can we not just accept that the root node is inaccessible and force the user to create a "home" route in the first tier of the hierarchy? |
in phpcr terms we would then have /cms/menu// but it could just be /cms/menu/ if we would support rendering the root. forcing that home node might be simpler though, but then you can't technically prevent the end users from adding menus on the same level as the home node, which is inelegant. |
If we force the user to create the "home" node it would not be I can see how having the home node at the root would be useful in a breadcrumb trail. One problem with "forcing" the home node to be rendered would be order - the user would not be able to set the position of the node in the rendered menu. Another option might be for one item to alias another, so Maybe @stof has an opinion on this? |
the root node of a menu is at the same time the "name" of the menu. so knp_menu('bla') would be the menu under /cms/menu/bla . my opinion would be to have a global option to render the root node as first level and everything under it as second. and similar for a breadcrumb. if you want the home link as sibling of others, then it should be just a child of the root node. |
Not sure I understand, if we have the root node "blah" and the 1st level children "Home", "Services" and "Contact" then |
what i suggest is that if i have root node
the default should be to not render this. but as you say, for a breadcrumb it could be really useful. if Home is just / i could hardcode that in my template, but that would fail for sub-domain install and app_dev.php and generally be inelegant... if i can link main-menu with my home route or home content document and have the menu handle it, this would be solved. |
With the existing logic, I would guess implementing a breadcrumb you would indeed render the root node, however the standard horizontal template would not. So all good there. We can (and I think should) add the "Home" node as a child of the root node. Am I correct in thinking that the problem is when you are on the "Home" page and the breadcrumb would perhaps render:
? |
what do you mean by "add the Home node as child of the root node"? if you tell the menu to render the root, the navigation would render that as first level. in breadcrumb it would work too. if you have both, the breadcrumb on the homepage could look wrong. but then either you could hide the breadcrumb or just render the right menu node or directly the route instead of a real breadcrumb. or render the breadcrumb without root node, if the twig function has an option for that. |
I mean what you said for adding a child to the root node. And I agree with your second paragraph - everything works as we have described - so what is the issue? Is this a non-issue? In addition I can imagine that in some cases the "root" node in a breadcrumb would be rendered as an icon, e.g. |
sorry, should have re-read my own comment :-) i think with the discussion in #55 it would really make sense to make the root node of a menu to extend MenuNode and have an option to tell whether we want the menu tree to include root or not. when i render a horizontal navigation i don't want home in it. but when rendering some tree or sitemap or breadcrumb i might want it there. if i add Home as child in the tree of documents, we would need a way to skip it in some cases, or go one level deeper, which is the same problem but less elegant. |
ping |
the root node extends MenuNode indeed. i just checked in the sandbox, the breadcrumb showing "Start" changes when you change the /cms/menu/main title |
support to render the menu root as home link. the workaround is rather complicated: https://github.com/symfony-cmf/symfony-cmf-website/pull/6/files#diff-34
if we render the root, it would in html live separated. should we have a feature to squash it into the first level? => check what KnpMenu currently does and see if its just a documentation issue.
The text was updated successfully, but these errors were encountered: