TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
rte_ckeditor/Classes/Form/Resolver/RichTextNodeResolver.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\RteCKEditor\Form\Resolver;
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 
27 {
33  protected $data;
34 
41  public function __construct(NodeFactory $nodeFactory, array $data)
42  {
43  $this->data = $data;
44  }
45 
51  public function resolve()
52  {
53  $table = $this->data['tableName'];
54  $fieldName = $this->data['fieldName'];
55  $row = $this->data['databaseRow'];
56  $parameterArray = $this->data['parameterArray'];
57  $backendUser = $this->getBackendUserAuthentication();
58 
59  if (// This field is not read only
60  !$parameterArray['fieldConf']['config']['readOnly']
61  // If RTE is generally enabled by user settings and RTE object registry can return something valid
62  && $backendUser->isRTE()
63  ) {
64  // @todo: Most of this stuff is prepared by data providers within $this->data already
65  $specialConfiguration = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']);
66  // If "richtext" is within defaultExtras
67  if (isset($specialConfiguration['richtext'])) {
68  // Operates by reference on $row! 'pid' is changed ...
70  list($recordPid, $tsConfigPid) = BackendUtility::getTSCpidCached($table, $row['uid'], $row['pid']);
71  // If the pid-value is not negative (that is, a pid could NOT be fetched)
72  if ($tsConfigPid >= 0) {
73  // Fetch page ts config and do some magic with it to find out if RTE is disabled on TS level.
74  $rteSetup = $backendUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($recordPid));
75  $rteTcaTypeValue = $this->data['recordTypeValue'];
76  $rteSetupConfiguration = BackendUtility::RTEsetup($rteSetup['properties'], $table, $fieldName, $rteTcaTypeValue);
77  if (!$rteSetupConfiguration['disabled']) {
78  // Finally, we're sure the editor should really be rendered ...
79  return RichTextElement::class;
80  }
81  }
82  }
83  }
84  return null;
85  }
86 
90  protected function getBackendUserAuthentication()
91  {
92  return $GLOBALS['BE_USER'];
93  }
94 }
static getPagesTSconfig($id, $rootLine=null, $returnPartArray=false)
if(TYPO3_MODE=== 'BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']
static RTEsetup($RTEprop, $table, $field, $type= '')
static fixVersioningPid($table, &$rr, $ignoreWorkspaceMatch=false)