TYPO3 CMS  TYPO3_8-7
RichTextNodeResolver.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 
26 {
32  protected $data;
33 
40  public function __construct(NodeFactory $nodeFactory, array $data)
41  {
42  $this->data = $data;
43  }
44 
50  public function resolve()
51  {
52  $parameterArray = $this->data['parameterArray'];
53  $backendUser = $this->getBackendUserAuthentication();
54  if (// This field is not read only
55  !$parameterArray['fieldConf']['config']['readOnly']
56  // If RTE is generally enabled by user settings and RTE object registry can return something valid
57  && $backendUser->isRTE()
58  // If RTE is enabled for field
59  && isset($parameterArray['fieldConf']['config']['enableRichtext'])
60  && (bool)$parameterArray['fieldConf']['config']['enableRichtext'] === true
61  // If RTE config is found (prepared by TcaText data provider)
62  && isset($parameterArray['fieldConf']['config']['richtextConfiguration'])
63  && is_array($parameterArray['fieldConf']['config']['richtextConfiguration'])
64  // If RTE is not disabled on configuration level
65  && !$parameterArray['fieldConf']['config']['richtextConfiguration']['disabled']
66  ) {
67  return RichTextElement::class;
68  }
69  return null;
70  }
71 
75  protected function getBackendUserAuthentication()
76  {
77  return $GLOBALS['BE_USER'];
78  }
79 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']