TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
AbstractMenuViewHelper.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\FluidStyledContent\ViewHelpers\Menu;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
20 
25 {
42  protected function getPageConstraints($includeNotInMenu = false, $includeMenuSeparator = false)
43  {
44  $constraints = [];
45 
47 
48  if (!$includeNotInMenu) {
49  $constraints[] = 'nav_hide = 0';
50  }
51 
52  if (!$includeMenuSeparator) {
53  $constraints[] = 'doktype != ' . PageRepository::DOKTYPE_SPACER;
54  }
55 
56  return 'AND ' . implode(' AND ', $constraints);
57  }
58 
67  protected function getPageUids(array $pageUids, $entryLevel = 0)
68  {
69  $typoScriptFrontendController = $this->getTypoScriptFrontendController();
70 
71  // Remove empty entries from array
72  $pageUids = array_filter($pageUids);
73 
74  // If no pages have been defined, use the current page
75  if (empty($pageUids)) {
76  if ($entryLevel !== null) {
77  if ($entryLevel < 0) {
78  $entryLevel = count($typoScriptFrontendController->tmpl->rootLine) - 1 + $entryLevel;
79  }
80  $pageUids = [$typoScriptFrontendController->tmpl->rootLine[$entryLevel]['uid']];
81  } else {
82  $pageUids = [$typoScriptFrontendController->id];
83  }
84  }
85 
86  return $pageUids;
87  }
88 
93  protected function renderChildrenWithVariables(array $variables)
94  {
95  foreach ($variables as $name => $value) {
96  $this->templateVariableContainer->add($name, $value);
97  }
98 
99  $output = $this->renderChildren();
100 
101  foreach ($variables as $name => $_) {
102  $this->templateVariableContainer->remove($name);
103  }
104 
105  return $output;
106  }
107 
111  protected function getTypoScriptFrontendController()
112  {
113  return $GLOBALS['TSFE'];
114  }
115 }
if(TYPO3_MODE=== 'BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']
getPageConstraints($includeNotInMenu=false, $includeMenuSeparator=false)