TYPO3 CMS  TYPO3_8-7
AbstractLinkHandler.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 
22 
28 abstract class AbstractLinkHandler
29 {
37  protected $linkAttributes = [ 'target', 'title', 'class', 'params', 'rel' ];
38 
42  protected $updateSupported = true;
43 
47  protected $linkBrowser;
48 
52  protected $iconFactory;
53 
57  protected $view;
58 
62  public function __construct()
63  {
64  }
65 
73  public function initialize(AbstractLinkBrowserController $linkBrowser, $identifier, array $configuration)
74  {
75  $this->linkBrowser = $linkBrowser;
76  $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
77  $this->view = GeneralUtility::makeInstance(\TYPO3\CMS\Fluid\View\StandaloneView::class);
78  $this->view->getRequest()->setControllerExtensionName('recordlist');
79  $this->view->setTemplateRootPaths([GeneralUtility::getFileAbsFileName('EXT:recordlist/Resources/Private/Templates/LinkBrowser')]);
80  $this->view->setPartialRootPaths([GeneralUtility::getFileAbsFileName('EXT:recordlist/Resources/Private/Partials/LinkBrowser')]);
81  $this->view->setLayoutRootPaths([GeneralUtility::getFileAbsFileName('EXT:recordlist/Resources/Private/Layouts/LinkBrowser')]);
82  }
83 
87  public function getLinkAttributes()
88  {
89  return $this->linkAttributes;
90  }
91 
96  public function modifyLinkAttributes(array $fieldDefinitions)
97  {
98  return $fieldDefinitions;
99  }
100 
108  public function isUpdateSupported()
109  {
110  return $this->updateSupported;
111  }
112 
116  protected function setTemporaryDbMounts()
117  {
118  $backendUser = $this->getBackendUser();
119 
120  // Clear temporary DB mounts
121  $tmpMount = GeneralUtility::_GET('setTempDBmount');
122  if (isset($tmpMount)) {
123  $backendUser->setAndSaveSessionData('pageTree_temporaryMountPoint', (int)$tmpMount);
124  }
125  // Set temporary DB mounts
126  $alternativeWebmountPoint = (int)$backendUser->getSessionData('pageTree_temporaryMountPoint');
127  if ($alternativeWebmountPoint) {
128  $alternativeWebmountPoint = GeneralUtility::intExplode(',', $alternativeWebmountPoint);
129  $backendUser->setWebmounts($alternativeWebmountPoint);
130  } else {
131  // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
132  $alternativeWebmountPoints = trim($backendUser->getTSConfigVal('options.pageTree.altElementBrowserMountPoints'));
133  $appendAlternativeWebmountPoints = $backendUser->getTSConfigVal('options.pageTree.altElementBrowserMountPoints.append');
134  if ($alternativeWebmountPoints) {
135  $alternativeWebmountPoints = GeneralUtility::intExplode(',', $alternativeWebmountPoints);
136  $this->getBackendUser()->setWebmounts($alternativeWebmountPoints, $appendAlternativeWebmountPoints);
137  }
138  }
139  }
140 
144  protected function getBackendUser()
145  {
146  return $GLOBALS['BE_USER'];
147  }
148 
152  protected function getLanguageService()
153  {
154  return $GLOBALS['LANG'];
155  }
156 }
static intExplode($delimiter, $string, $removeEmptyValues=false, $limit=0)
static getFileAbsFileName($filename, $_=null, $_2=null)
static makeInstance($className,... $constructorArguments)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']