Skip to content

Instantly share code, notes, and snippets.

@chriwo
Last active August 14, 2016 18:44
Show Gist options
  • Save chriwo/e9288b91ced942157a65f093e40efd34 to your computer and use it in GitHub Desktop.
Save chriwo/e9288b91ced942157a65f093e40efd34 to your computer and use it in GitHub Desktop.
Append categories to main menu
appendCategoryMenu {
# cat=appendCategoryMenu/navigation/10; type=string; label=complete string of navigation lib
menuLibary =
# cat=appendCategoryMenu/navigation/20; type=int+; label=UID of navigation point
menuPid =
# cat=appendCategoryMenu/navigation/30; type=int+; label=UID of category pages
defaultCategoryPid =
#cat=appendCategoryMenu/navigation/40; type=int+; label=UID of the parent category. All subcategories would be used in the menu
parentCategory = 0
}
# Category menu as sublevel menu
############################################
lib.categoryMenu = COA
lib.categoryMenu {
wrap = <ul class="dropdown-menu graybg-bottom">|</ul>
10 = CONTENT
10 {
table = sys_category
select {
pidInList = {$plugin.tx_news.persistence.storagePid}
andWwhere.dataWrap = parentcategory={$appendCategoryMenu.parentCategory}
}
renderObj = COA
renderObj {
10 = TEXT
10 {
field = title
typolink {
# listPid
parameter.dataWrap = {$appendCategoryMenu.defaultCategoryPid}
# add link params
additionalParams = &tx_news_pi1[overwriteDemand][categories]={field:uid}
additionalParams.insertData = 1
useCacheHash = 1
no_cache = 0
}
wrap = <li role="presentation">|</li>
}
}
}
}
{$appendCategoryMenu.menuLibary} {
1 {
NO {
# move parent categories as sub menu entry
after.cObject = CASE
after.cObject {
key.field = uid
# e.g. uid 51 of page to append the parent categories
{$appendCategoryMenu.menuPid} < lib.categoryMenu
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment