‪TYPO3CMS  ‪main
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 
18 use TYPO3\CMS\Backend\Utility\BackendUtility;
23 
29 {
30  public function ‪__construct()
31  {
32  trigger_error(__CLASS__ . ' will be removed in TYPO3 v13, as Tree implementations should be built with Web Components', E_USER_DEPRECATED);
33  parent::__construct();
34  }
35 
43  public function ‪init(‪$clause = '', ‪$orderByFields = '')
44  {
45  $backendUser = $this->‪getBackendUser();
46  // This will hide records from display - it has nothing to do with user rights!!
47  $clauseExcludePidList = '';
48  $pidList = (string)($backendUser->getTSConfig()['options.']['hideRecords.']['pages'] ?? '');
49  if (!empty($pidList)) {
50  if ($pidList = implode(',', ‪GeneralUtility::intExplode(',', $pidList))) {
51  $clauseExcludePidList = ' AND pages.uid NOT IN (' . $pidList . ')';
52  }
53  }
54  // This is very important for making trees of pages: Filtering out deleted pages, pages with no access to and sorting them correctly:
55  parent::init(' AND deleted=0 AND sys_language_uid=0 AND ' . $backendUser->getPagePermsClause(‪Permission::PAGE_SHOW) . ' ' . ‪$clause . $clauseExcludePidList, 'sorting');
56  }
57 
65  public function ‪getTitleAttrib($row)
66  {
67  return BackendUtility::titleAttribForPages($row, '1=1 ' . $this->clause, false);
68  }
69 
78  public function ‪getTitleStr($row, $titleLen = 30)
79  {
80  ‪$title = parent::getTitleStr($row, $titleLen);
81  if (!empty($row['is_siteroot'])
82  && ($this->‪getBackendUser()->getTSConfig()['options.']['pageTree.']['showDomainNameWithTitle'] ?? false)
83  ) {
84  $pageId = (int)$row['uid'];
85  $siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
86  try {
87  $site = $siteFinder->getSiteByRootPageId($pageId);
88  ‪$title .= ' [' . (string)$site->getBase() . ']';
89  } catch (‪SiteNotFoundException $e) {
90  // No site found
91  }
92  }
93  return ‪$title;
94  }
95 }
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$clause
‪string $clause
Definition: AbstractTreeView.php:84
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$title
‪string $title
Definition: AbstractTreeView.php:53
‪TYPO3\CMS\Core\Exception\SiteNotFoundException
Definition: SiteNotFoundException.php:26
‪TYPO3\CMS\Core\Site\SiteFinder
Definition: SiteFinder.php:31
‪TYPO3\CMS\Core\Type\Bitmask\Permission
Definition: Permission.php:26
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\getTitleAttrib
‪string getTitleAttrib($row)
Definition: BrowseTreeView.php:65
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\getTitleStr
‪string getTitleStr($row, $titleLen=30)
Definition: BrowseTreeView.php:78
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$orderByFields
‪string $orderByFields
Definition: AbstractTreeView.php:92
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\__construct
‪__construct()
Definition: BrowseTreeView.php:30
‪TYPO3\CMS\Core\Type\Bitmask\Permission\PAGE_SHOW
‪const PAGE_SHOW
Definition: Permission.php:35
‪TYPO3\CMS\Backend\Tree\View
Definition: AbstractContentPagePositionMap.php:18
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView\init
‪init($clause='', $orderByFields='')
Definition: BrowseTreeView.php:43
‪TYPO3\CMS\Backend\Tree\View\BrowseTreeView
Definition: BrowseTreeView.php:29
‪TYPO3\CMS\Core\Utility\GeneralUtility\intExplode
‪static int[] intExplode($delimiter, $string, $removeEmptyValues=false, $limit=0)
Definition: GeneralUtility.php:842
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getBackendUser
‪getBackendUser()
Definition: AbstractTreeView.php:615
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:51
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView
Definition: AbstractTreeView.php:40