-
Notifications
You must be signed in to change notification settings - Fork 156
Conversation
@dantleech is there any status on this? If not, I'll prefer if you create an issue instead of an empty WIP pr. |
This is my WIP for the Menu Documentation update.. note that it will not be finished tomorrow ... |
The CmfMenuBundle extends the `KnpMenuBundle`_ by adding a menu provider | ||
that loads menus from a doctrine object manager and generating menu URLs | ||
from content. | ||
* Render menus stored in the persistance layer; |
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.
the rendering is still done by knp. we only load menus from storage i would say
coming good, i like for example the rendering section. needs a rebase now. lets merge soon before somebody else touches menu doc as there are big content moves in this PR. |
@@ -0,0 +1,186 @@ | |||
.. _bundles_menu_current_menu_item: |
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.
remove this and add an index directive
Have refactored the voters section a little bit @dbu |
``Symfony\Cmf\Bundle\RoutingBundle\Routing\DynamicRouter::CONTENT_KEY`` (which resolves to ``contentDocument``). | ||
|
||
You can enable this voter by setting ``cmf_menu.voters.content_identity`` | ||
to ``null`` in your configuration to use a custom ``content_key`` for the main |
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.
should we say "to any value (e.g. null
)" ? as it is its a bit confusing.
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.
Or maybe adding the cmf_menu.voters.content_identity
parameter to your configuration? - wouldn't setting the value to a string break as it expects an array?
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.
right - i don't know what the configuration class will accept or not. but the di code only checks isset on the content_identity field.
brilliant, really love it! thanks dan. i added some minor things here and there. can you please check the travis build error? looks like you missed to add the reference file maybe? /home/travis/build/symfony-cmf/symfony-cmf-docs/index.rst:130: WARNING: toctree contains reference to nonexisting document u'reference/configuration/menu-bundle' |
its menu items correspond to the page the user is currently viewing. | ||
|
||
The KnpMenuBundle will identify a current menu item if the current request URI | ||
matches the URI of the menu item. |
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.
btw - I have searched the KnpMenuBundle for some code which sets the current URI from the request and sets the current menu item but can't find it -- where does this actually "happen" ??
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.
not exactly sure but i found $menuItem->setCurrentUri($this->request->getRequestUri());
in PhpcrMenuProvider. i guess afterwards "something" looks at the current uri and compares that with the item uri (maybe the model itself?)
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.
Ah yeah, that makes sense then. I was looking for that in Knp.
On Wed, Oct 02, 2013 at 01:36:06PM -0700, David Buchmann wrote:
In bundles/menu/voters.rst:
@@ -0,0 +1,237 @@
+.. index::
- single: current menu item; MenuBundle;
+Current Menu Item Voters
+========================
+
+One of the aims of any menu system is to inform the user about where they are
+in relation to the rest of the site. To do this the system needs to know which of
+its menu items correspond to the page the user is currently viewing.
+
+The KnpMenuBundle will identify a current menu item if the current request URI
+matches the URI of the menu item.not exactly sure but i found
$menuItem->setCurrentUri($this->request->getRequestUri()); in
PhpcrMenuProvider. i guess afterwards "something" looks at the current uri
and compares that with the item uri (maybe the model itself?)—
Reply to this email directly or [1]view it on GitHub.References
Visible links
ok.. I have finished the Voters section. Its all good for me pending a final review. |
that if this document does not exist it must be created. | ||
|
||
The example below creates a new menu with two items, "Home" and "Contact" and | ||
we specify a URI for each:: |
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.
always avoid 'we' in the documentation.
Removed all "we" references. |
configuration reference is missing from this PR https://github.com/symfony-cmf/symfony-cmf-docs/tree/master/reference/configuration of course this can be finished in a later PR |
|
+1 to merge! thanks a lot dan. |
Updating Menu documentation.