‪TYPO3CMS  10.4
BrowseTreeView.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 
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_state',
41  'hidden',
42  'starttime',
43  'endtime',
44  'fe_group',
45  'module',
46  'extendToSubpages',
47  'nav_hide',
48  't3ver_wsid',
49  't3ver_move_id',
50  'is_siteroot'
51  ];
52 
57  public ‪$treeName = 'browsePages';
58 
63  public ‪$table = 'pages';
64 
69  public ‪$domIdPrefix = 'pages';
70 
74  public ‪$ext_showNavTitle = false;
75 
83  public function ‪init(‪$clause = '', ‪$orderByFields = '')
84  {
85  $backendUser = $this->‪getBackendUser();
86  // This will hide records from display - it has nothing to do with user rights!!
87  $clauseExcludePidList = '';
88  $pidList = $backendUser->getTSConfig()['options.']['hideRecords.']['pages'] ?? '';
89  if (!empty($pidList)) {
90  if ($pidList = implode(',', ‪GeneralUtility::intExplode(',', $pidList))) {
91  $clauseExcludePidList = ' AND pages.uid NOT IN (' . $pidList . ')';
92  }
93  }
94  // This is very important for making trees of pages: Filtering out deleted pages, pages with no access to and sorting them correctly:
95  parent::init(' AND deleted=0 AND sys_language_uid=0 AND ' . $backendUser->getPagePermsClause(‪Permission::PAGE_SHOW) . ' ' . ‪$clause . $clauseExcludePidList, 'sorting');
96  $this->title = ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
97  $this->MOUNTS = $backendUser->returnWebmounts();
98  if ($pidList) {
99  // Remove mountpoint if explicitly set in options.hideRecords.pages (see above)
100  $hideList = explode(',', $pidList);
101  $this->MOUNTS = array_diff($this->MOUNTS, $hideList);
102  }
103  }
104 
112  public function ‪getTitleAttrib($row)
113  {
114  return ‪BackendUtility::titleAttribForPages($row, '1=1 ' . $this->clause, false);
115  }
116 
125  public function ‪wrapIcon($icon, $row)
126  {
127  // Wrap icon in click-menu link.
128  $theIcon = '';
129  if (!$this->ext_IconMode) {
130  $theIcon = ‪BackendUtility::wrapClickMenuOnIcon($icon, $this->treeName, $this->‪getId($row), '0');
131  } elseif ($this->ext_IconMode === 'titlelink') {
132  $aOnClick = 'return jumpTo(' . GeneralUtility::quoteJSvalue($this->‪getJumpToParam($row)) . ',this,'
133  . GeneralUtility::quoteJSvalue($this->domIdPrefix . $this->‪getId($row)) . ',' . $this->bank . ');';
134  $theIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
135  }
136  return $theIcon;
137  }
138 
147  public function ‪getTitleStr($row, $titleLen = 30)
148  {
149  if ($this->ext_showNavTitle && isset($row['nav_title']) && trim($row['nav_title']) !== '') {
150  ‪$title = parent::getTitleStr(['title' => $row['nav_title']], $titleLen);
151  } else {
152  ‪$title = parent::getTitleStr($row, $titleLen);
153  }
154  if (!empty($row['is_siteroot'])
155  && $this->‪getBackendUser()->getTSConfig()['options.']['pageTree.']['showDomainNameWithTitle'] ?? false
156  ) {
157  $pageId = (int)$row['uid'];
158  $siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
159  try {
160  $site = $siteFinder->getSiteByRootPageId($pageId);
161  ‪$title .= ' [' . (string)$site->getBase() . ']';
162  } catch (SiteNotFoundException $e) {
163  // No site found
164  }
165  }
166  return ‪$title;
167  }
168 }
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$clause
‪string $clause
Definition: AbstractTreeView.php:119
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$title
‪string $title
Definition: AbstractTreeView.php:74
‪TYPO3\CMS\Core\Exception\SiteNotFoundException
Definition: SiteNotFoundException.php:26
‪TYPO3\CMS\Core\Site\SiteFinder
Definition: SiteFinder.php:31
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\$ext_showNavTitle
‪bool $ext_showNavTitle
Definition: BrowseTreeView.php:69
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getId
‪int getId($row)
Definition: AbstractTreeView.php:666
‪TYPO3\CMS\Core\Type\Bitmask\Permission
Definition: Permission.php:24
‪TYPO3\CMS\Backend\Utility\BackendUtility\wrapClickMenuOnIcon
‪static string wrapClickMenuOnIcon( $content, $table, $uid=0, $context='', $_addParams='', $_enDisItems='', $returnTagParameters=false)
Definition: BackendUtility.php:2510
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\getTitleAttrib
‪string getTitleAttrib($row)
Definition: BrowseTreeView.php:107
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\getTitleStr
‪string getTitleStr($row, $titleLen=30)
Definition: BrowseTreeView.php:142
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$orderByFields
‪string $orderByFields
Definition: AbstractTreeView.php:127
‪TYPO3\CMS\Backend\Utility\BackendUtility\titleAttribForPages
‪static string titleAttribForPages($row, $perms_clause='', $includeAttrib=true)
Definition: BackendUtility.php:1244
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getBackendUser
‪BackendUserAuthentication getBackendUser()
Definition: AbstractTreeView.php:949
‪TYPO3\CMS\Core\Type\Bitmask\Permission\PAGE_SHOW
‪const PAGE_SHOW
Definition: Permission.php:33
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getJumpToParam
‪string getJumpToParam($row)
Definition: AbstractTreeView.php:677
‪TYPO3\CMS\Backend\Tree\View
Definition: AbstractTreeView.php:16
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:75
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\$domIdPrefix
‪string $domIdPrefix
Definition: BrowseTreeView.php:65
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\init
‪init($clause='', $orderByFields='')
Definition: BrowseTreeView.php:78
‪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:60
‪TYPO3\CMS\Core\Utility\GeneralUtility\intExplode
‪static int[] intExplode($delimiter, $string, $removeEmptyValues=false, $limit=0)
Definition: GeneralUtility.php:988
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\wrapIcon
‪string wrapIcon($icon, $row)
Definition: BrowseTreeView.php:120
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\$fieldArray
‪array $fieldArray
Definition: BrowseTreeView.php:31
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView
Definition: AbstractTreeView.php:34
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\$treeName
‪string $treeName
Definition: BrowseTreeView.php:55