Feature #14575
closedAdd a startUid to a hmenu with special = keywords
0%
Description
I would like to add a new option to a HMENU when special is set to keywords.
I added a 'startUid' option that basicly does the same as the 'value' of the directory option. So instead of supplying a level we can also tell the system to start at a other UID instead of starting at a different level. When the startUid is supplied, the level is ignored!!!
I needed such a option because our website massivly relies on finding pages using keyword. and this way I can show a menu of a other level.
The startUid uses the stdWrap method so users can supply a PHP function (like I do) to find a page within the system.
For example:
lib.leftmenu.100.50.20.special.startUid.postUserFunc.setKeywords = citypage
lib.leftmenu.100.50.20.special.startUid.postUserFunc = tx_ltgextendedmenus_pi1->ts_findPageUid
This means, when I am in a structure BELOW a city like restaurant, hotels etc. etc. then we can show the menu of the city itself. the 'ts_findPageUid' is a little PHP fucntion to find page within out system
I hope it will make it into T# version 3.8.0!
cheers,
Ries
class.tslib_menu.php
LINE548 // start point
$eLevel = tslib_cObj::getKey (intval($this->conf['special.']['entryLevel']),$this->tmpl->rootLine);
-- //$startUid = intval($this->tmpl->rootLine[$eLevel]['uid']);
+ // Get a alternative start UID
+ if ($this->conf['special.']['startUid'] || $this->conf['special.']['startUid.']) {
+ $startUid = $this->parent_cObj->stdWrap($this->conf['special.']['startUid'], $this->conf['special.']['startUid.']);
+ } else {
+ $startUid = intval($this->tmpl->rootLine[$eLevel]['uid']);
+ }
// which field is for keywords
$kfield = 'keywords';
if ( $this->conf['special.']['keywordsField'] ) {
list($kfield) = explode(' ',trim ($this->conf['special.']['keywordsField']));
}
(issue imported from #M839)
Files