‪TYPO3CMS  9.5
ElementBrowserFolderTreeView.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 
21 
31 {
35  public ‪$ext_IconMode = 'titlelink';
36 
40  protected ‪$linkParameterProvider;
41 
46  {
47  $this->linkParameterProvider = ‪$linkParameterProvider;
48  $this->thisScript = ‪$linkParameterProvider->‪getScriptUrl();
49  }
50 
60  public function ‪wrapIcon($icon, $folderObject)
61  {
62  // Add title attribute to input icon tag
63  $theFolderIcon = '';
64 
65  // Wrap icon in link (in ElementBrowser only the "titlelink" is used).
66  if ($this->ext_IconMode === 'titlelink') {
68  $this->linkParameterProvider->getUrlParameters(['identifier' => $folderObject->getCombinedIdentifier()])
69  );
70  $aOnClick = 'return jumpToUrl(' . GeneralUtility::quoteJSvalue($this->‪getThisScript() . $parameters) . ');';
71  $theFolderIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
72  }
73 
74  return $theFolderIcon;
75  }
76 
85  public function ‪wrapTitle(‪$title, $folderObject, ‪$bank = 0)
86  {
88  $this->linkParameterProvider->getUrlParameters(['identifier' => $folderObject->getCombinedIdentifier()])
89  );
90  return '<a href="#" onclick="return jumpToUrl(' . htmlspecialchars(GeneralUtility::quoteJSvalue($this->‪getThisScript() . $parameters)) . ');">' . ‪$title . '</a>';
91  }
92 
100  public function ‪ext_isLinkable(‪Folder $folderObject)
101  {
102  trigger_error('This method is obsolete and will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
103  return true;
104  }
105 
111  protected function ‪renderPMIconAndLink($cmd, $isOpen)
112  {
113  if (static::class === __CLASS__) {
114  return $this->‪PMiconATagWrap('', $cmd, !$isOpen);
115  }
116  return parent::renderPMIconAndLink($cmd, $isOpen);
117  }
118 
129  public function ‪PM_ATagWrap($icon, $cmd, $bMark = '', $isOpen = false)
130  {
131  $anchor = $bMark ? '#' . $bMark : '';
132  $name = $bMark ? ' name=' . $bMark : '';
133  $urlParameters = $this->linkParameterProvider->getUrlParameters([]);
134  $urlParameters['PM'] = $cmd;
135  $aOnClick = 'return jumpToUrl(' . GeneralUtility::quoteJSvalue($this->‪getThisScript() . ‪HttpUtility::buildQueryString($urlParameters)) . ',' . GeneralUtility::quoteJSvalue($anchor) . ');';
136  return '<a href="#"' . htmlspecialchars($name) . ' onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
137  }
138 
148  public function ‪PMiconATagWrap($icon, $cmd, $isExpand = true)
149  {
150  if (empty($this->scope)) {
151  $this->scope = [
152  'class' => static::class,
153  'script' => ‪$this->thisScript,
154  'browser' => $this->linkParameterProvider->getUrlParameters([]),
155  ];
156  }
157 
158  return parent::PMiconATagWrap($icon, $cmd, $isExpand);
159  }
160 }
‪TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView\renderPMIconAndLink
‪string renderPMIconAndLink($cmd, $isOpen)
Definition: ElementBrowserFolderTreeView.php:109
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$title
‪string $title
Definition: AbstractTreeView.php:73
‪TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView\setLinkParameterProvider
‪setLinkParameterProvider(LinkParameterProviderInterface $linkParameterProvider)
Definition: ElementBrowserFolderTreeView.php:43
‪TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView
Definition: ElementBrowserFolderTreeView.php:31
‪TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView\wrapIcon
‪string wrapIcon($icon, $folderObject)
Definition: ElementBrowserFolderTreeView.php:58
‪TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView\PM_ATagWrap
‪string PM_ATagWrap($icon, $cmd, $bMark='', $isOpen=false)
Definition: ElementBrowserFolderTreeView.php:127
‪TYPO3\CMS\Core\Resource\Folder
Definition: Folder.php:34
‪TYPO3\CMS\Core\Utility\HttpUtility\buildQueryString
‪static string buildQueryString(array $parameters, string $prependCharacter='', bool $skipEmptyParameters=false)
Definition: HttpUtility.php:160
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$bank
‪int $bank
Definition: AbstractTreeView.php:240
‪TYPO3\CMS\Backend\Tree\View\FolderTreeView
Definition: FolderTreeView.php:36
‪TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView\wrapTitle
‪string wrapTitle($title, $folderObject, $bank=0)
Definition: ElementBrowserFolderTreeView.php:83
‪TYPO3\CMS\Backend\Tree\View
Definition: AbstractTreeView.php:2
‪TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView\$linkParameterProvider
‪LinkParameterProviderInterface $linkParameterProvider
Definition: ElementBrowserFolderTreeView.php:38
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getThisScript
‪string getThisScript()
Definition: AbstractTreeView.php:276
‪TYPO3\CMS\Core\Utility\HttpUtility
Definition: HttpUtility.php:21
‪TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView\ext_isLinkable
‪bool ext_isLinkable(Folder $folderObject)
Definition: ElementBrowserFolderTreeView.php:98
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView\PMiconATagWrap
‪string PMiconATagWrap($icon, $cmd, $isExpand=true)
Definition: ElementBrowserFolderTreeView.php:146
‪TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView\$ext_IconMode
‪string $ext_IconMode
Definition: ElementBrowserFolderTreeView.php:34
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$thisScript
‪string $thisScript
Definition: AbstractTreeView.php:48