‪TYPO3CMS  9.5
FileEditHook.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
24 
30 {
40  public function ‪preOutputProcessingHook(array $parameters, ‪EditFileController $pObj)
41  {
42  // Compile and register t3editor configuration
43  GeneralUtility::makeInstance(T3editor::class)->registerConfiguration();
44 
45  $target = '';
46  if (isset($parameters['target']) && is_string($parameters['target'])) {
47  $target = $parameters['target'];
48  }
49 
51  $modeRegistry = GeneralUtility::makeInstance(ModeRegistry::class);
52  try {
53  $mode = $modeRegistry->getByFileExtension($fileExtension);
54  } catch (‪InvalidModeException $e) {
55  $mode = $modeRegistry->getDefaultMode();
56  }
57 
58  $parameters['dataColumnDefinition']['config']['renderType'] = 't3editor';
59  $parameters['dataColumnDefinition']['config']['format'] = $mode->getFormatCode();
60  }
61 }
‪TYPO3\CMS\T3editor\Hook\FileEditHook\preOutputProcessingHook
‪preOutputProcessingHook(array $parameters, EditFileController $pObj)
Definition: FileEditHook.php:40
‪TYPO3\CMS\T3editor\Hook\FileEditHook
Definition: FileEditHook.php:30
‪TYPO3\CMS\Core\Resource\ResourceFactory\getInstance
‪static ResourceFactory getInstance()
Definition: ResourceFactory.php:39
‪TYPO3\CMS\T3editor\Hook
Definition: FileEditHook.php:3
‪TYPO3\CMS\Core\Resource\ResourceFactory
Definition: ResourceFactory.php:33
‪TYPO3\CMS\T3editor\T3editor
Definition: T3editor.php:32
‪TYPO3\CMS\T3editor\Exception\InvalidModeException
Definition: InvalidModeException.php:25
‪TYPO3\CMS\Core\Resource\AbstractFile\getExtension
‪string getExtension()
Definition: AbstractFile.php:252
‪TYPO3\CMS\T3editor\Registry\ModeRegistry
Definition: ModeRegistry.php:28
‪TYPO3\CMS\Backend\Controller\File\EditFileController
Definition: EditFileController.php:46
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Resource\ResourceFactory\retrieveFileOrFolderObject
‪File Folder null retrieveFileOrFolderObject($input)
Definition: ResourceFactory.php:491