|
| 1 | +:navigation-title: Breadcrumb |
| 2 | + |
| 3 | +.. include:: /Includes.rst.txt |
| 4 | + |
| 5 | +.. _meta-menu: |
| 6 | + |
| 7 | +================================ |
| 8 | +Meta menu / Footer menu in TYPO3 |
| 9 | +================================ |
| 10 | + |
| 11 | +A meta menu - often but not always displayed in the footer of a website - |
| 12 | +displays only selected pages like "Imprint", "Contact", "Data Privacy", ... |
| 13 | + |
| 14 | +If you use a `Generated site package <https://docs.typo3.org/permalink/t3sitepackage:minimal-design>`_ |
| 15 | +it already contains a meta menu in the footer of the page. |
| 16 | + |
| 17 | +To display a breadcrumb the `menu data processor <https://docs.typo3.org/permalink/t3tsref:menuprocessor>`_ |
| 18 | +can be used with the special type `List <https://docs.typo3.org/permalink/t3tsref:hmenu-special-list>`_ |
| 19 | +or `Directory <https://docs.typo3.org/permalink/t3tsref:hmenu-special-directory>`_. |
| 20 | + |
| 21 | +The special menu type "List" allows you to specify a list of UIDs of pages that |
| 22 | +should be displayed in the meta menu. The special menu type "Directory" allows |
| 23 | +you to specify a folder or page of which all subpages should be displayed in |
| 24 | +the menu. We take the second approach here. |
| 25 | + |
| 26 | +.. _meta-menu-typoscript: |
| 27 | + |
| 28 | +Menu of subpages TypoScript - the data processor |
| 29 | +================================================ |
| 30 | + |
| 31 | +.. literalinclude:: /CodeSnippets/my_site_package/Configuration/Sets/SitePackage/TypoScript/Navigation/footerMenu.typoscript |
| 32 | + :caption: packages/my_site_package/Configuration/Sets/SitePackage/TypoScript/Navigation/footerMenu.typoscript |
| 33 | + :linenos: |
| 34 | + :emphasize-lines: 7-8 |
| 35 | + |
| 36 | +Line 4: Each data processor must have a unique id. We used 10 for the |
| 37 | +`page-content data processor <https://docs.typo3.org/permalink/t3sitepackage:page-content-data-processor>`_ |
| 38 | +and 20 for the :ref:`Main menu <main-menu-creation>` and 30 for the |
| 39 | +`Breadcrumb <https://docs.typo3.org/permalink/t3sitepackage:breadcrumb>`_ |
| 40 | +therefore we now use 40. |
| 41 | + |
| 42 | +Line 6: The values processed by the data processor should be stored in variable |
| 43 | +`footerMenu`. |
| 44 | + |
| 45 | +Line 7: We configure the menu to use the special type |
| 46 | +`Directory <https://docs.typo3.org/permalink/t3tsref:hmenu-special-directory>`_. |
| 47 | + |
| 48 | +Line 8: The folder which contains the pages to be displayed in the footer menu |
| 49 | +can be configured via site settings. You can find the definition of this setting |
| 50 | +in file :file:`packages/my_site_package/Configuration/Sets/SitePackage/settings.definitions.yaml`. |
| 51 | + |
| 52 | +.. _meta-menu-fluid: |
| 53 | + |
| 54 | +Menu of subpages - Fluid template |
| 55 | +================================= |
| 56 | + |
| 57 | +The special type `directory` delivers the items of the meta menu as an array. |
| 58 | +Therefore we can use the `For ViewHelper <f:for> <https://docs.typo3.org/permalink/t3viewhelper:typo3fluid-fluid-for>`_ |
| 59 | +to loop through these elements: |
| 60 | + |
| 61 | +.. literalinclude:: /CodeSnippets/my_site_package/Resources/Private/PageView/Partials/Navigation/FooterMenu.html |
| 62 | + :caption: packages/my_site_package/Resources/Private/PageView/Partials/Navigation/FooterMenu.html |
| 63 | + :linenos: |
| 64 | + |
| 65 | +The menu items can be displayed just as we have done in the |
| 66 | +`Fluid partial of the main menu <https://docs.typo3.org/permalink/t3sitepackage:fluid-implement-main-menu>`_. |
| 67 | + |
| 68 | +As we do not need to highlight active pages in the footer menu we omit those |
| 69 | +conditions. |
| 70 | + |
| 71 | +.. _meta-menu-list: |
| 72 | + |
| 73 | +Switching to the menu type list |
| 74 | +=============================== |
| 75 | + |
| 76 | +If it is more feasible for your project to list all pages that should be listed |
| 77 | +in the meta menu, you can switch to using the special menu type "List" by |
| 78 | +changing the TypoScript: |
| 79 | + |
| 80 | +.. code-block:: diff |
| 81 | + :caption: packages/my_site_package/Configuration/Sets/SitePackage/settings.definitions.yaml (diff) |
| 82 | +
|
| 83 | + 40 = menu |
| 84 | + 40 { |
| 85 | + as = footerMenu |
| 86 | + - special = directory |
| 87 | + + special = list |
| 88 | + special.value = {$MySitePackage.footerMenuRoot} |
| 89 | + } |
| 90 | +
|
| 91 | +You can now change the setting to accept a comma separated list of integers |
| 92 | +and then list all pages that should be displayed in the meta menu. For example: |
| 93 | + |
| 94 | +.. code-block:: diff |
| 95 | + :caption: packages/my_site_package/Configuration/Sets/SitePackage/TypoScript/Navigation/footerMenu.typoscript (diff) |
| 96 | +
|
| 97 | + MySitePackage.footerMenuRoot: |
| 98 | + label: 'Footer menu root uid' |
| 99 | + - description: 'The subpages of this page are displayed in the footer' |
| 100 | + + description: 'These pages are displayed in the footer' |
| 101 | + category: MySitePackage.menus |
| 102 | + - type: int |
| 103 | + + type: stringlist |
| 104 | + - default: 2 |
| 105 | + + default: |
| 106 | + + - 5 |
| 107 | + + - 4 |
| 108 | + + - 3 |
| 109 | +
|
| 110 | +We are using the type :ref:`stringlist <t3coreapi:confval-site-setting-type-stringlist>` |
| 111 | +- as of writing these lines - there is no integer list type in the settings yet. |
0 commit comments