TYPO3 CMS  TYPO3_7-6
MenuViewHelperTrait.php
Go to the documentation of this file.
1 <?php
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 
19 
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  return $pageUids;
77  }
78 
79  if ($entryLevel === null) {
80  return [$typoScriptFrontendController->id];
81  }
82 
83  if ($entryLevel < 0) {
84  $entryLevel = count($typoScriptFrontendController->tmpl->rootLine) - 1 + $entryLevel;
85  }
86  if (isset($typoScriptFrontendController->tmpl->rootLine[$entryLevel]['uid'])) {
87  return [$typoScriptFrontendController->tmpl->rootLine[$entryLevel]['uid']];
88  }
89  return [];
90  }
91 
96  protected function renderChildrenWithVariables(array $variables)
97  {
98  foreach ($variables as $name => $value) {
99  $this->templateVariableContainer->add($name, $value);
100  }
101 
102  $output = $this->renderChildren();
103 
104  foreach ($variables as $name => $_) {
105  $this->templateVariableContainer->remove($name);
106  }
107 
108  return $output;
109  }
110 
114  protected function getTypoScriptFrontendController()
115  {
116  return $GLOBALS['TSFE'];
117  }
118 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']