Skip to content

Commit cbf15af

Browse files
github-actions[bot]linawolffroemken
authored
[Backport 13.4] [TASK] Document Footer menu (#344)
* [TASK] Document Footer menu Releases: main, 13.4 * Update Documentation/Menu/MetaMenu.rst Co-authored-by: Stefan Frömken <[email protected]> * Update Documentation/Menu/MetaMenu.rst Co-authored-by: Stefan Frömken <[email protected]> --------- Co-authored-by: lina.wolf <[email protected]> Co-authored-by: Lina Wolf <[email protected]> Co-authored-by: Stefan Frömken <[email protected]>
1 parent 71cac54 commit cbf15af

File tree

3 files changed

+117
-2
lines changed

3 files changed

+117
-2
lines changed

Documentation/Menu/Breadcrumb.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
:navigation-title: Breadcrumb
2+
23
.. include:: /Includes.rst.txt
34

45
.. _breadcrumb:

Documentation/Menu/Index.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
:navigation-title: Menus
2-
.. include:: /Includes.rst.txt
2+
3+
.. include:: /Includes.rst.txt
34

45
.. _menu:
56

@@ -156,4 +157,6 @@ to demonstrate different menu types:
156157
* A breadcrumb configured in
157158
:file:`packages/my_site_package/Configuration/Sets/SitePackage/TypoScript/Navigation/breadcrumb.typoscript`
158159
and rendered in :file:`packages/my_site_package/Resources/Private/PageView/Partials/Navigation/Breadcrumb.html`.
159-
* A footer menu (example is still missing).
160+
* A footer menu consisting of pages within a selected folder configured in
161+
:file:`packages/my_site_package/Configuration/Sets/SitePackage/TypoScript/Navigation/footerMenu.typoscript`
162+
and rendered in :file:`packages/my_site_package/Resources/Private/PageView/Partials/Navigation/FooterMenu.html`.

Documentation/Menu/MetaMenu.rst

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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

Comments
 (0)