Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Home link #15

Closed
dbu opened this issue Sep 26, 2012 · 12 comments
Closed

Home link #15

dbu opened this issue Sep 26, 2012 · 12 comments

Comments

@dbu
Copy link
Member

dbu commented Sep 26, 2012

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.

@dantleech
Copy link
Member

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?

@dbu
Copy link
Member Author

dbu commented May 3, 2013

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.

@dantleech
Copy link
Member

If we force the user to create the "home" node it would not be cms/menu/home ?

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 /cms/menu/home => /cms/menu and so we still have a concrete node instance but all the actual data is contained in the root node.

Maybe @stof has an opinion on this?

@dbu
Copy link
Member Author

dbu commented May 11, 2013

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.

@dantleech
Copy link
Member

Not sure I understand, if we have the root node "blah" and the 1st level children "Home", "Services" and "Contact" then knp_menu(blah) would render Home | Services | Contact no? So are you suggesting that we don't change anything?

@dbu
Copy link
Member Author

dbu commented May 12, 2013

what i suggest is that if i have root node main-menu labelled "Home" with children "services" and "contacts", when we enable the option it would render

- Home
    - Services
    - Contact

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.

@dantleech
Copy link
Member

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:

Home > Home

?

@dbu
Copy link
Member Author

dbu commented May 13, 2013

what do you mean by "add the Home node as child of the root node"?
imo if the user wants home to be another menu point along with others, then he should just add a menu entry "home" under the root node. but in some cases (like breadcrumb) it would make sense to have the root node itself be a menu node that points to home (it would have a label for whatever name, no need to handle anything different here).

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.

@dantleech
Copy link
Member

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. o so on the home page it would read o > Home - and in this case there is no problem.

@dbu
Copy link
Member Author

dbu commented May 13, 2013

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.

@lsmith77
Copy link
Member

lsmith77 commented Aug 9, 2013

ping

@dbu
Copy link
Member Author

dbu commented Aug 9, 2013

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

@dbu dbu closed this as completed Aug 9, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants