<commit_before>Using Zend\\Navigation in your Album Module
===========================================

In this tutorial we will use the :ref:`Zend\\Navigation component <zend.navigation.intro>`
to add a navigation menu to the black bar at the top of the screen, and add
breadcrumbs above the main site content.

Preparation
-----------

In a real world application, the album browser would be only a portion of a working website. Usually the user 
would land on a homepage first, and be able to view albums by using a standard navigation menu. So that we 
have a site that is more realistic than just the albums feature, lets make the standard skeleton welcome page 
our homepage, with the `/album` route still showing our album module. In order to make this change, we need to
undo some work we did earlier. Currently, navigating to the root of your app (/) routes you to the 
``AlbumController``'s default action. Let's undo this route change so we have two discrete entry points to the 
app, a home page, and an albums area.

``module/Application/config/module.config.php``

.. code-block:: php
   :linenos:

    'home' => array(
       'type' => 'Zend\Mvc\Router\Http\Literal',
        'options' => array(
            'route'    => '/',
            'defaults' => array(
                'controller' => 'Application\Controller\Index', // <-- change back here
                'action'     => 'index',
            ),
        ),
    ),

This change means that if you go to the home page of your application
(http://zf2-tutorial.localhost/), you see the default skeleton
application introduction. Your list of albums is still available at the
/album route.

Setting Up Zend\\Navigation
---------------------------

Firstly, we need to tell our application which ``NavigationFactory`` to
use when using the bundled navigation view helpers. Thankfully, ZF2
comes with a default factory that will suit our needs just fine. To tell
ZF2 to use this default factory, we simply add a ``navigation`` key to
the service manager. Its best to do this in the ``Application`` module,
because, like the translation data, this is specific to the entire
application, and not just to our album pages:

``module/Application/config/module.config.php``

.. code-block:: php
   :linenos:

    'service_manager' => array(
        'factories' => array(
            'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
            'navigation' => 'Zend\Navigation\Service\DefaultNavigationFactory', // <-- add this
        ),
    ),

Configuring our Site Map
------------------------

Next up, we need ``Zend\Navigation`` to understand the hierarchy of our
site. Thankfully, if we add a ``navigation`` key to our merged config,<commit_msg>Fix tutorials/tutorial.navigation.rst broken link<commit_after>Using Zend\\Navigation in your Album Module
===========================================

In this tutorial we will use the :ref:`Zend\\Navigation component <zend.navigation.intro>`
to add a navigation menu to the black bar at the top of the screen, and add
breadcrumbs above the main site content.

Preparation
-----------

In a real world application, the album browser would be only a portion of a working website. Usually the user 
would land on a homepage first, and be able to view albums by using a standard navigation menu. So that we 
have a site that is more realistic than just the albums feature, lets make the standard skeleton welcome page 
our homepage, with the `/album` route still showing our album module. In order to make this change, we need to
undo some work we did earlier. Currently, navigating to the root of your app (/) routes you to the 
``AlbumController``'s default action. Let's undo this route change so we have two discrete entry points to the 
app, a home page, and an albums area.

``module/Application/config/module.config.php``

.. code-block:: php
   :linenos:

    'home' => array(
       'type' => 'Zend\Mvc\Router\Http\Literal',
        'options' => array(
            'route'    => '/',
            'defaults' => array(
                'controller' => 'Application\Controller\Index', // <-- change back here
                'action'     => 'index',
            ),
        ),
    ),

This change means that if you go to the home page of your application
(``http://zf2-tutorial.localhost/``), you see the default skeleton
application introduction. Your list of albums is still available at the
/album route.

Setting Up Zend\\Navigation
---------------------------

Firstly, we need to tell our application which ``NavigationFactory`` to
use when using the bundled navigation view helpers. Thankfully, ZF2
comes with a default factory that will suit our needs just fine. To tell
ZF2 to use this default factory, we simply add a ``navigation`` key to
the service manager. Its best to do this in the ``Application`` module,
because, like the translation data, this is specific to the entire
application, and not just to our album pages:

``module/Application/config/module.config.php``

.. code-block:: php
   :linenos:

    'service_manager' => array(
        'factories' => array(
            'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
            'navigation' => 'Zend\Navigation\Service\DefaultNavigationFactory', // <-- add this
        ),
    ),

Configuring our Site Map
------------------------

Next up, we need ``Zend\Navigation`` to understand the hierarchy of our
site. Thankfully, if we add a ``navigation`` key to our merged config,
{'fraction_non_alphanumeric': 0.12140516927557335, 'fraction_numerical': 0.0018201674554058974, 'mean_word_length': 3.0613451589061347, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5894920', 'n_tokens_mistral': 1430, 'n_tokens_neox': 1382, 'n_words': 678}