Feature #65208
closedlevelfield with fieldToSearch and fieldToGet
0%
Description
Hi,
I'm creating a menu of pages. I create a special field : is_microsite (boolean), which allow me to know which page should be based of my HMENU. To create my menu, I must check if is_microsite is true, and get page's uid where it's true.
For exemple :
Website : (level 1, uid:1, is_microsite:false, no menu) Page Test (level 2, uid:2, is_microsite:false, no menu) Page Test 2 (level 3, uid:3, is_microsite:true, menu of subpages (first level) of "Page Test 2") Page Test 3 (level 4, uid:4, is_microsite:false, menu of subpages (first level) of "Page Test 2") Page Test 4 (level 5, uid:5, is_microsite:false, menu of subpages (first level) of "Page Test 2") Page Test 5 (level 4, uid:6, is_microsite:false, menu of subpages (first level) of "Page Test 2")
For the moment, the current TS :
levelfield:-1, is_microsite, slide
returns the value of is_microsite, if it's true. I cannot know which page has is_microsite setted, so I cannot create an HMENU of subpages (first level) of this page.
I didn't find a workaround for my case.
My solution, for my example, is the following :
lib.menu = HMENU lib.menu { if.isTrue.data = levelfield:-1, is_microsite!uid, slide special = directory special.value.data = levelfield:-1, is_microsite!uid, slide wrap = <nav>|</nav> 1 = TMENU 1 { wrap = <ul>|</ul> NO = 1 NO.wrapItemAndSub = <li>|</li> ACT < .NO CUR < .NO CUR.wrapItemAndSub = <li class="selected">|</li> } }
In \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer :
public function rootLineValue($key, $field, $slideBack = 0, $altRootLine = '') { $rootLine = is_array($altRootLine) ? $altRootLine : $GLOBALS['TSFE']->tmpl->rootLine; $fieldParts = GeneralUtility::trimExplode('!', $field); $fieldToSearch = $fieldParts[0]; if(!isset($fieldParts[1])) { $fieldToGet = $fieldParts[0]; } else { $fieldToGet = $fieldParts[1]; } if (!$slideBack) { return $rootLine[$key][$fieldToGet]; } else { for ($a = $key; $a >= 0; $a--) { $val = $rootLine[$a][$fieldToSearch]; if ($val) { return $rootLine[$a][$fieldToGet]; } } } }
If "$field" has the delimiter "!", it allow check which page has $fieldToSearch to true and return page's $fieldToGet.
What do you think ?
Updated by Susanne Moog almost 5 years ago
- Status changed from New to Closed
As this has not gotten any priority over the last few years the demand seems to be low we are therefor closing this request now.
Additionally, with fluid and recent updates in menu processing, menu generation has gotten easier and more flexible in recent years.