Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
svenpet90 committed Feb 4, 2022
0 parents commit b304e38
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
9 changes: 9 additions & 0 deletions Configuration/TCA/Overrides/sys_template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

defined('TYPO3') || die();

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'headless_navigations',
'Configuration/TypoScript',
'Headless Navigations'
);
Empty file.
59 changes: 59 additions & 0 deletions Configuration/TypoScript/constants.typoscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
page {
navigations {
navigation1 {
# cat=bootstrap package: 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
navigationType = directory
# cat=bootstrap package: 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
expandAll = 1
# cat=bootstrap package: navigations/100/navigation1_entryLevel; type=int; label=Navigation1 entry level
entryLevel =
# cat=bootstrap package: navigations/100/navigation1_includeSpacer; type=boolean; label=Navigation1 include spacer
includeSpacer = 1
# cat=bootstrap package: 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
navigationValue =
# cat=bootstrap package: 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
includeNotInMenu = 0
# cat=bootstrap package: navigations/101/navigation2_expandAll; type=boolean; label=Navigation2 expandAll
expandAll = 1
# cat=bootstrap package: navigations/101/navigation2_entryLevel; type=int; label=Navigation2 entry level
entryLevel =
# cat=bootstrap package: navigations/101/navigation2_includeSpacer; type=boolean; label=Navigation2 include spacer
includeSpacer = 1
# cat=bootstrap package: 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
navigationValue =
# cat=bootstrap package: 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
includeNotInMenu = 0
# cat=bootstrap package: navigations/103/navigation3_expandAll; type=boolean; label=Navigation3 expandAll
expandAll = 1
# cat=bootstrap package: navigations/103/navigation3_entryLevel; type=int; label=Navigation3 entry level
entryLevel =
# cat=bootstrap package: navigations/103/navigation3_includeSpacer; type=boolean; label=Navigation3 include spacer
includeSpacer = 1
# cat=bootstrap package: 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
languageValue = auto
}
}
}
108 changes: 108 additions & 0 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
lib.navigationDefault {
dataProcessing {
10 = FriendsOfTYPO3\Headless\DataProcessing\MenuProcessor
10 {
special = rootline
special.value = -8
levels = 7
expandAll = 1
includeSpacer = 0
titleField = nav_title // title
as = navigation

dataProcessing {
10 = FriendsOfTYPO3\Headless\DataProcessing\FilesProcessor
10 {
references.fieldName = nav_icon
as = nav_icon
}
}
}
}
}

lib.navigations {
fields {
navigation1 < lib.navigationDefault
navigation2 < lib.navigationDefault
navigation3 < lib.navigationDefault
breadcrumbs < lib.navigationDefault

navigation1.dataProcessing.10 {
as = navigation1
special = {$page.navigations.navigation1.navigationType}
special.value = {$page.navigations.navigation1.navigationValue}
entryLevel = {$page.navigations.navigation1.entryLevel}
expandAll = {$page.navigations.navigation1.expandAll}
includeNotInMenu = {$page.navigations.navigation1.includeNotInMenu}
includeSpacer = {$page.navigations.navigation1.includeSpacer}
levels = {$page.navigations.navigation1.levels}
}

navigation2.dataProcessing.10 {
as = navigation2
special = {$page.navigations.navigation2.navigationType}
special.value = {$page.navigations.navigation2.navigationValue}
entryLevel = {$page.navigations.navigation2.entryLevel}
expandAll = {$page.navigations.navigation2.expandAll}
includeNotInMenu = {$page.navigations.navigation2.includeNotInMenu}
includeSpacer = {$page.navigations.navigation2.includeSpacer}
levels = {$page.navigations.navigation2.levels}
}

navigation3.dataProcessing.10 {
as = navigation3
special = {$page.navigations.navigation3.navigationType}
special.value = {$page.navigations.navigation3.navigationValue}
entryLevel = {$page.navigations.navigation3.entryLevel}
expandAll = {$page.navigations.navigation3.expandAll}
includeNotInMenu = {$page.navigations.navigation3.includeNotInMenu}
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}
}
}
}
}
}

lib.navigations = JSON
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 >
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# TYPO3 Extension "headless_naviations" - Provides TypoScript definitions to enrich the EXT:headless page response with proper navigations
This extension ... @todo add documentation

## Requirements
Extension requires TYPO3 in version at least 11.5.

## TYPO3 Installation
Install extension using composer\
``composer require friendsoftypo3headless/headless-navigations``

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

### Developers involved in the project

- Sven Petersen (DAUSKONZEPT GmbH && HardAnders GbR)
- Niels Seelhöfer
26 changes: 26 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "friendsoftypo3headless/headless-navigations",
"type": "typo3-cms-extension",
"description": "This extension enhances the EXT:headless json response with three customizable navigations.",
"keywords": [
"TYPO3",
"headless",
"pwa",
"json",
"navigations"
],
"license": [
"GPL-2.0-or-later"
],
"require": {
"typo3/cms-core": "^11.5"
},
"suggest": {
"friendsoftypo3/headless": "^2.0"
},
"extra": {
"typo3/cms": {
"extension-key": "headless_navigations"
}
}
}

0 comments on commit b304e38

Please sign in to comment.