‪TYPO3CMS  9.5
BrowseTreeView.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 
23 
28 {
32  public ‪$fieldArray = [
33  'uid',
34  'pid',
35  'title',
36  'doktype',
37  'nav_title',
38  'mount_pid',
39  'php_tree_stop',
40  't3ver_id',
41  't3ver_state',
42  'hidden',
43  'starttime',
44  'endtime',
45  'fe_group',
46  'module',
47  'extendToSubpages',
48  'nav_hide',
49  't3ver_wsid',
50  't3ver_move_id',
51  'is_siteroot'
52  ];
53 
58  public ‪$treeName = 'browsePages';
59 
64  public ‪$table = 'pages';
65 
70  public ‪$domIdPrefix = 'pages';
71 
75  public ‪$ext_showNavTitle = false;
76 
84  public function ‪init(‪$clause = '', ‪$orderByFields = '')
85  {
86  $backendUser = $this->‪getBackendUser();
87  // This will hide records from display - it has nothing to do with user rights!!
88  $clauseExcludePidList = '';
89  $pidList = $backendUser->getTSConfig()['options.']['hideRecords.']['pages'] ?? '';
90  if (!empty($pidList)) {
91  if ($pidList = implode(',', GeneralUtility::intExplode(',', $pidList))) {
92  $clauseExcludePidList = ' AND pages.uid NOT IN (' . $pidList . ')';
93  }
94  }
95  // This is very important for making trees of pages: Filtering out deleted pages, pages with no access to and sorting them correctly:
96  parent::init(' AND deleted=0 AND sys_language_uid=0 AND ' . $backendUser->getPagePermsClause(‪Permission::PAGE_SHOW) . ' ' . ‪$clause . $clauseExcludePidList, 'sorting');
97  $this->title = ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
98  $this->MOUNTS = $backendUser->returnWebmounts();
99  if ($pidList) {
100  // Remove mountpoint if explicitly set in options.hideRecords.pages (see above)
101  $hideList = explode(',', $pidList);
102  $this->MOUNTS = array_diff($this->MOUNTS, $hideList);
103  }
104  }
105 
113  public function ‪getTitleAttrib($row)
114  {
115  return ‪BackendUtility::titleAttribForPages($row, '1=1 ' . $this->clause, 0);
116  }
117 
126  public function ‪wrapIcon($icon, $row)
127  {
128  // Wrap icon in click-menu link.
129  $theIcon = '';
130  if (!$this->ext_IconMode) {
131  $theIcon = ‪BackendUtility::wrapClickMenuOnIcon($icon, $this->treeName, $this->‪getId($row), 0);
132  } elseif ($this->ext_IconMode === 'titlelink') {
133  $aOnClick = 'return jumpTo(' . GeneralUtility::quoteJSvalue($this->‪getJumpToParam($row)) . ',this,'
134  . GeneralUtility::quoteJSvalue($this->domIdPrefix . $this->‪getId($row)) . ',' . $this->bank . ');';
135  $theIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
136  }
137  return $theIcon;
138  }
139 
148  public function ‪getTitleStr($row, $titleLen = 30)
149  {
150  if ($this->ext_showNavTitle && isset($row['nav_title']) && trim($row['nav_title']) !== '') {
151  ‪$title = parent::getTitleStr(['title' => $row['nav_title']], $titleLen);
152  } else {
153  ‪$title = parent::getTitleStr($row, $titleLen);
154  }
155  if (!empty($row['is_siteroot'])
156  && $this->‪getBackendUser()->getTSConfig()['options.']['pageTree.']['showDomainNameWithTitle'] ?? false
157  ) {
158  $pageId = (int)$row['uid'];
159  $siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
160  try {
161  $site = $siteFinder->getSiteByRootPageId($pageId);
162  ‪$title .= ' [' . (string)$site->getBase() . ']';
163  } catch (SiteNotFoundException $e) {
164  // No site found, let's see if it is a legacy-pseudo-site
165  $pseudoSiteFinder = GeneralUtility::makeInstance(PseudoSiteFinder::class);
166 
167  try {
168  $site = $pseudoSiteFinder->getSiteByRootPageId($pageId);
169  ‪$title .= ' [' . trim((string)$site->getBase(), '/') . ']';
170  } catch (SiteNotFoundException $e) {
171  // No pseudo-site found either
172  }
173  }
174  }
175  return ‪$title;
176  }
177 }
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$clause
‪string $clause
Definition: AbstractTreeView.php:118
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$title
‪string $title
Definition: AbstractTreeView.php:73
‪TYPO3\CMS\Core\Exception\SiteNotFoundException
Definition: SiteNotFoundException.php:25
‪TYPO3\CMS\Core\Site\SiteFinder
Definition: SiteFinder.php:31
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\$ext_showNavTitle
‪bool $ext_showNavTitle
Definition: BrowseTreeView.php:70
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getId
‪int getId($row)
Definition: AbstractTreeView.php:694
‪TYPO3\CMS\Core\Type\Bitmask\Permission
Definition: Permission.php:23
‪TYPO3\CMS\Backend\Utility\BackendUtility\wrapClickMenuOnIcon
‪static string wrapClickMenuOnIcon( $content, $table, $uid=0, $context='', $_addParams='', $_enDisItems='', $returnTagParameters=false)
Definition: BackendUtility.php:2759
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\getTitleAttrib
‪string getTitleAttrib($row)
Definition: BrowseTreeView.php:108
‪TYPO3\CMS\Core\Site\PseudoSiteFinder
Definition: PseudoSiteFinder.php:39
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\getTitleStr
‪string getTitleStr($row, $titleLen=30)
Definition: BrowseTreeView.php:143
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$orderByFields
‪string $orderByFields
Definition: AbstractTreeView.php:126
‪TYPO3\CMS\Backend\Utility\BackendUtility\titleAttribForPages
‪static string titleAttribForPages($row, $perms_clause='', $includeAttrib=true)
Definition: BackendUtility.php:1502
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getBackendUser
‪BackendUserAuthentication getBackendUser()
Definition: AbstractTreeView.php:1065
‪TYPO3\CMS\Core\Type\Bitmask\Permission\PAGE_SHOW
‪const PAGE_SHOW
Definition: Permission.php:32
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getJumpToParam
‪string getJumpToParam($row)
Definition: AbstractTreeView.php:705
‪TYPO3\CMS\Backend\Tree\View
Definition: AbstractTreeView.php:2
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:72
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\$domIdPrefix
‪string $domIdPrefix
Definition: BrowseTreeView.php:66
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\init
‪init($clause='', $orderByFields='')
Definition: BrowseTreeView.php:79
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView
Definition: BrowseTreeView.php:28
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\$table
‪string $table
Definition: BrowseTreeView.php:61
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\wrapIcon
‪string wrapIcon($icon, $row)
Definition: BrowseTreeView.php:121
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\$fieldArray
‪array $fieldArray
Definition: BrowseTreeView.php:31
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView
Definition: AbstractTreeView.php:33
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\$treeName
‪string $treeName
Definition: BrowseTreeView.php:56