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

[WIP] Update menu documentation #183

Merged
merged 14 commits into from
Oct 5, 2013
Merged

Conversation

dantleech
Copy link
Member

Updating Menu documentation.

@wouterj
Copy link
Member

wouterj commented Aug 22, 2013

@dantleech is there any status on this? If not, I'll prefer if you create an issue instead of an empty WIP pr.

@ghost ghost assigned dantleech Sep 13, 2013
@dantleech
Copy link
Member Author

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;
Copy link
Member

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

@dbu
Copy link
Member

dbu commented Sep 30, 2013

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:
Copy link
Member

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

@dantleech
Copy link
Member Author

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
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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.

@dbu
Copy link
Member

dbu commented Oct 2, 2013

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.
Copy link
Member Author

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" ??

Copy link
Member

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?)

Copy link
Member Author

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

  1. https://github.com/symfony-cmf/symfony-cmf-docs/pull/183/files#r6727166

@dantleech
Copy link
Member Author

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::
Copy link
Member

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.

@dantleech
Copy link
Member Author

Removed all "we" references.

@lsmith77
Copy link
Member

lsmith77 commented Oct 4, 2013

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

@lsmith77
Copy link
Member

lsmith77 commented Oct 4, 2013

/home/travis/build/symfony-cmf/symfony-cmf-docs/bundles/block/types.rst:22: WARNING: undefined label: bundle-core-publish-workflow (if the link has no caption the label must precede a section header)

@dbu
Copy link
Member

dbu commented Oct 4, 2013

+1 to merge! thanks a lot dan.

dbu added a commit that referenced this pull request Oct 5, 2013
[WIP] Update menu documentation
@dbu dbu merged commit 148387f into symfony-cmf:master Oct 5, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants