‪TYPO3CMS  10.4
HierarchicalMenuContentObject.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
21 
26 {
33  public function ‪render($conf = [])
34  {
35  if (!empty($conf['if.']) && !$this->cObj->checkIf($conf['if.'])) {
36  return '';
37  }
38 
39  $theValue = '';
40  $menuType = $conf[1];
41  try {
43  $menuObjectFactory = GeneralUtility::makeInstance(MenuContentObjectFactory::class);
44  $menu = $menuObjectFactory->getMenuObjectByType($menuType);
45  if (isset(‪$GLOBALS['TSFE']->register['count_HMENU'])) {
46  ‪$GLOBALS['TSFE']->register['count_HMENU']++;
47  } else {
48  ‪$GLOBALS['TSFE']->register['count_HMENU'] = 1;
49  }
50  ‪$GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'] = 0;
51  ‪$GLOBALS['TSFE']->register['count_MENUOBJ'] = 0;
52  $menu->parent_cObj = ‪$this->cObj;
53  $menu->‪start(‪$GLOBALS['TSFE']->tmpl, ‪$GLOBALS['TSFE']->sys_page, '', $conf, 1);
54  $menu->makeMenu();
55  $theValue .= $menu->writeMenu();
56  } catch (‪NoSuchMenuTypeException $e) {
57  }
58  $wrap = isset($conf['wrap.']) ? $this->cObj->stdWrap($conf['wrap'], $conf['wrap.']) : $conf['wrap'];
59  if ($wrap) {
60  $theValue = $this->cObj->wrap($theValue, $wrap);
61  }
62  if (isset($conf['stdWrap.'])) {
63  $theValue = $this->cObj->stdWrap($theValue, $conf['stdWrap.']);
64  }
65  return $theValue;
66  }
67 }
‪TYPO3\CMS\Frontend\ContentObject\Menu\Exception\NoSuchMenuTypeException
Definition: NoSuchMenuTypeException.php:24
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\start
‪start($data, $table='')
Definition: ContentObjectRenderer.php:533
‪TYPO3\CMS\Frontend\ContentObject\HierarchicalMenuContentObject
Definition: HierarchicalMenuContentObject.php:26
‪TYPO3\CMS\Frontend\ContentObject
Definition: AbstractContentObject.php:16
‪TYPO3\CMS\Frontend\ContentObject\AbstractContentObject
Definition: AbstractContentObject.php:25
‪TYPO3\CMS\Frontend\ContentObject\AbstractContentObject\$cObj
‪ContentObjectRenderer $cObj
Definition: AbstractContentObject.php:28
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Frontend\ContentObject\HierarchicalMenuContentObject\render
‪string render($conf=[])
Definition: HierarchicalMenuContentObject.php:33
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Frontend\ContentObject\Menu\MenuContentObjectFactory
Definition: MenuContentObjectFactory.php:29