2 namespace TYPO3\CMS\FluidStyledContent\ViewHelpers\Menu;
40 use MenuViewHelperTrait;
49 $this->
registerArgument(
'as',
'string',
'Name of the template variable that will contain selected pages',
true);
50 $this->
registerArgument(
'pageUids',
'array',
'Page UIDs of parent pages',
false, array());
51 $this->
registerArgument(
'sortField',
'string',
'Field to sort pages; possible values: starttime, lastUpdated, tstamp, crdate',
false,
'SYS_LASTCHANGED');
52 $this->
registerArgument(
'maximumAge',
'string',
'Maximum age of pages to be included; supports mathematical expressions',
false,
'604800');
53 $this->
registerArgument(
'includeNotInMenu',
'boolean',
'Include pages that are marked "hide in menu"?',
false,
false);
54 $this->
registerArgument(
'includeMenuSeparator',
'boolean',
'Include pages of the type "Menu separator"?',
false,
false);
55 $this->
registerArgument(
'excludeNoSearchPages',
'boolean',
'Exclude pages that are NOT marked "include in search"?',
false,
true);
65 $typoScriptFrontendController = $this->getTypoScriptFrontendController();
66 $as = (string)$this->arguments[
'as'];
67 $pageUids = (array)$this->arguments[
'pageUids'];
68 $sortField = $this->arguments[
'sortField'];
69 $maximumAge = $this->arguments[
'maximumAge'];
70 $includeNotInMenu = (bool)$this->arguments[
'includeNotInMenu'];
71 $includeMenuSeparator = (bool)$this->arguments[
'includeMenuSeparator'];
72 $excludeNoSearchPages = (bool)$this->arguments[
'excludeNoSearchPages'];
75 if (empty($pageUids)) {
76 $pageUids = array($typoScriptFrontendController->page[
'uid']);
79 $unfilteredPageTreeUids = array();
80 foreach ($pageUids as $pageUid) {
81 $unfilteredPageTreeUids = array_merge(
82 $unfilteredPageTreeUids,
85 $typoScriptFrontendController->cObj->getTreeList($pageUid, 20)
89 $pageTreeUids = array_unique($unfilteredPageTreeUids);
91 $constraints = $this->getPageConstraints($includeNotInMenu, $includeMenuSeparator);
93 if ($excludeNoSearchPages) {
94 $constraints .=
' AND no_search = 0';
97 if (!in_array($sortField, [
'starttime',
'lastUpdated',
'tstamp',
'crdate'])) {
98 $sortField =
'SYS_LASTCHANGED';
101 $minimumTimeStamp = time() - (int)$typoScriptFrontendController->cObj->calc($maximumAge);
102 $constraints .=
' AND ' . $sortField .
' >=' . $minimumTimeStamp;
104 $pages = $typoScriptFrontendController->sys_page->getMenuForPages(
107 $sortField .
' DESC',
110 return $this->renderChildrenWithVariables(array(