Skip to content

Commit

Permalink
TypoScript tweaks and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
svenpet90 committed Feb 7, 2022
1 parent b304e38 commit a14fdab
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 61 deletions.
Empty file.
44 changes: 22 additions & 22 deletions Configuration/TypoScript/constants.typoscript
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
page {
navigations {
navigation1 {
# cat=bootstrap package: navigations/100/navigation1_navigationValue; type=string; label=Navigation1 Values: Comma separated list of page uids
# cat=headless navigations/100/navigation1_navigationValue; type=string; label=Navigation1 Values: Comma separated list of page uids
navigationValue =
# cat=bootstrap package: navigations/100/navigation1_navigationType; type=options[Directory=directory, List=list]; label=Navigation1 Type
# cat=headless navigations/100/navigation1_navigationType; type=options[Directory=directory, List=list]; label=Navigation1 Type
navigationType = directory
# cat=bootstrap package: navigations/100/navigation1_includeNotInMenu; type=boolean; label=Navigation1 include items not in menu
# cat=headless navigations/100/navigation1_includeNotInMenu; type=boolean; label=Navigation1 include items not in menu
includeNotInMenu = 0
# cat=bootstrap package: navigations/100/navigation1_expandAll; type=boolean; label=Navigation1 expandAll
# cat=headless navigations/100/navigation1_expandAll; type=boolean; label=Navigation1 expandAll
expandAll = 1
# cat=bootstrap package: navigations/100/navigation1_entryLevel; type=int; label=Navigation1 entry level
# cat=headless navigations/100/navigation1_entryLevel; type=int; label=Navigation1 entry level
entryLevel =
# cat=bootstrap package: navigations/100/navigation1_includeSpacer; type=boolean; label=Navigation1 include spacer
# cat=headless navigations/100/navigation1_includeSpacer; type=boolean; label=Navigation1 include spacer
includeSpacer = 1
# cat=bootstrap package: navigations/100/navigation1_levels; type=int+; label=Navigation1 levels
# cat=headless navigations/100/navigation1_levels; type=int+; label=Navigation1 levels
levels =
}

navigation2 {
# cat=bootstrap package: navigations/101/navigation2_navigationValue; type=string; label=Navigation2 Values: Comma separated list of page uids
# cat=headless navigations/101/navigation2_navigationValue; type=string; label=Navigation2 Values: Comma separated list of page uids
navigationValue =
# cat=bootstrap package: navigations/101/navigation2_navigationType; type=options[Directory=directory, List=list]; label=Navigation2 Type
# cat=headless navigations/101/navigation2_navigationType; type=options[Directory=directory, List=list]; label=Navigation2 Type
navigationType = directory
# cat=bootstrap package: navigations/101/navigation2_includeNotInMenu; type=boolean; label=Navigation2 include items not in menu
# cat=headless navigations/101/navigation2_includeNotInMenu; type=boolean; label=Navigation2 include items not in menu
includeNotInMenu = 0
# cat=bootstrap package: navigations/101/navigation2_expandAll; type=boolean; label=Navigation2 expandAll
# cat=headless navigations/101/navigation2_expandAll; type=boolean; label=Navigation2 expandAll
expandAll = 1
# cat=bootstrap package: navigations/101/navigation2_entryLevel; type=int; label=Navigation2 entry level
# cat=headless navigations/101/navigation2_entryLevel; type=int; label=Navigation2 entry level
entryLevel =
# cat=bootstrap package: navigations/101/navigation2_includeSpacer; type=boolean; label=Navigation2 include spacer
# cat=headless navigations/101/navigation2_includeSpacer; type=boolean; label=Navigation2 include spacer
includeSpacer = 1
# cat=bootstrap package: navigations/101/navigation2_levels; type=int+; label=Navigation2 levels
# cat=headless navigations/101/navigation2_levels; type=int+; label=Navigation2 levels
levels =
}

navigation3 {
# cat=bootstrap package: navigations/102/navigation3_navigationValue; type=string; label=Navigation3 Values: Comma separated list of page uids
# cat=headless navigations/102/navigation3_navigationValue; type=string; label=Navigation3 Values: Comma separated list of page uids
navigationValue =
# cat=bootstrap package: navigations/102/navigation3_navigationType; type=options[Directory=directory, List=list]; label=Navigation3 Type
# cat=headless navigations/102/navigation3_navigationType; type=options[Directory=directory, List=list]; label=Navigation3 Type
navigationType = directory
# cat=bootstrap package: navigations/103/navigation3_includeNotInMenu; type=boolean; label=Navigation3 include items not in menu
# cat=headless navigations/103/navigation3_includeNotInMenu; type=boolean; label=Navigation3 include items not in menu
includeNotInMenu = 0
# cat=bootstrap package: navigations/103/navigation3_expandAll; type=boolean; label=Navigation3 expandAll
# cat=headless navigations/103/navigation3_expandAll; type=boolean; label=Navigation3 expandAll
expandAll = 1
# cat=bootstrap package: navigations/103/navigation3_entryLevel; type=int; label=Navigation3 entry level
# cat=headless navigations/103/navigation3_entryLevel; type=int; label=Navigation3 entry level
entryLevel =
# cat=bootstrap package: navigations/103/navigation3_includeSpacer; type=boolean; label=Navigation3 include spacer
# cat=headless navigations/103/navigation3_includeSpacer; type=boolean; label=Navigation3 include spacer
includeSpacer = 1
# cat=bootstrap package: navigations/103/navigation3_levels; type=int+; label=Navigation3 levels
# cat=headless navigations/103/navigation3_levels; type=int+; label=Navigation3 levels
levels =
}

languages {
# cat=bootstrap package: navigations/104/languages_languageValue; type=string; label=Language Navigation Values: Comma separated list of language uids or set to 'auto' to load all enabled system languages
# cat=headless navigations/104/languages_languageValue; type=string; label=Language Navigation Values: Comma separated list of language uids or set to 'auto' to load all enabled system languages
languageValue = auto
}
}
Expand Down
36 changes: 0 additions & 36 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ lib.navigations {
navigation1 < lib.navigationDefault
navigation2 < lib.navigationDefault
navigation3 < lib.navigationDefault
breadcrumbs < lib.navigationDefault

navigation1.dataProcessing.10 {
as = navigation1
Expand Down Expand Up @@ -60,39 +59,6 @@ lib.navigations {
includeSpacer = {$page.navigations.navigation3.includeSpacer}
levels = {$page.navigations.navigation3.levels}
}

breadcrumbs.dataProcessing.10 {
as = breadcrumbs
special = rootline
special.range = 0|-1
expandAll = 0

includeSpacer = 1
includeNotInMenu = 1
if {
value = {$page.theme.breadcrumb.enableLevel}
value {
insertData = 1
prioriCalc = 1
stdWrap.wrap = |-1
}

isGreaterThan {
data = level
}
}
}

languages = JSON
languages {
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\LanguageMenuProcessor
10 {
as = languagenavigation
languages = {$page.navigations.languages.languageValue}
}
}
}
}
}

Expand All @@ -101,8 +67,6 @@ lib.navigations.navigation1 = JSON
lib.navigations.navigation2 = JSON
lib.navigations.navigation3 = JSON

page.10.fields.breadcrumbs >
page.10.fields.navigations =< lib.navigations
menu.10 >
menu.10 =< lib.navigations
page.10.fields.languages >
Binary file added Documentation/response.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# TYPO3 Extension "headless_naviations" - Provides TypoScript definitions to enrich the EXT:headless page response with proper navigations
This extension ... @todo add documentation
# TYPO3 Extension "headless_navigations" - Provides TypoScript definitions to enrich the [EXT:headless](https://github.com/TYPO3-Initiatives/headless) page response with proper navigations

This extension adds a "navigations" key to the default JSON response, provides constants to configure up to three custom navigations (e.g. "Main Navigation", "Meta navigation", "Side navigation") and outputs those as proper JSON to render menus in the Frontend applicaiton.

![Navigations array in default response](Documentation/response.png)

## Requirements
Extension requires TYPO3 in version at least 11.5.
Expand All @@ -8,7 +11,7 @@ Extension requires TYPO3 in version at least 11.5.
Install extension using composer\
``composer require friendsoftypo3headless/headless-navigations``

and then, include TypoScript template, configure the constants and you are ready to go.
and then, include the TypoScript template, configure the constants and you are ready to go.

### Developers involved in the project

Expand Down

0 comments on commit a14fdab

Please sign in to comment.