TYPO3 CMS  TYPO3_7-6
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  public function __construct()
58  {
59  }
60 
70  public function initialize(AbstractLinkBrowserController $linkBrowser, $identifier, array $configuration)
71  {
72  $this->linkBrowser = $linkBrowser;
73  $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
74  }
75 
79  public function getLinkAttributes()
80  {
81  return $this->linkAttributes;
82  }
83 
88  public function modifyLinkAttributes(array $fieldDefinitions)
89  {
90  return $fieldDefinitions;
91  }
92 
100  public function isUpdateSupported()
101  {
102  return $this->updateSupported;
103  }
104 
108  protected function setTemporaryDbMounts()
109  {
110  $backendUser = $this->getBackendUser();
111 
112  // Clear temporary DB mounts
113  $tmpMount = GeneralUtility::_GET('setTempDBmount');
114  if (isset($tmpMount)) {
115  $backendUser->setAndSaveSessionData('pageTree_temporaryMountPoint', (int)$tmpMount);
116  }
117  // Set temporary DB mounts
118  $alternativeWebmountPoint = (int)$backendUser->getSessionData('pageTree_temporaryMountPoint');
119  if ($alternativeWebmountPoint) {
120  $alternativeWebmountPoint = GeneralUtility::intExplode(',', $alternativeWebmountPoint);
121  $backendUser->setWebmounts($alternativeWebmountPoint);
122  } else {
123  // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
124  $alternativeWebmountPoints = trim($backendUser->getTSConfigVal('options.pageTree.altElementBrowserMountPoints'));
125  $appendAlternativeWebmountPoints = $backendUser->getTSConfigVal('options.pageTree.altElementBrowserMountPoints.append');
126  if ($alternativeWebmountPoints) {
127  $alternativeWebmountPoints = GeneralUtility::intExplode(',', $alternativeWebmountPoints);
128  $this->getBackendUser()->setWebmounts($alternativeWebmountPoints, $appendAlternativeWebmountPoints);
129  }
130  }
131  }
132 
136  protected function getBackendUser()
137  {
138  return $GLOBALS['BE_USER'];
139  }
140 
144  protected function getLanguageService()
145  {
146  return $GLOBALS['LANG'];
147  }
148 }
static intExplode($delimiter, $string, $removeEmptyValues=false, $limit=0)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']