[TASK] Add spaces around '=' of 'strict_types=1'
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Classes / Controller / AbstractBackendController.php
1 <?php
2 declare(strict_types = 1);
3 namespace TYPO3\CMS\Form\Controller;
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
18 use TYPO3\CMS\Core\Utility\GeneralUtility;
19 use TYPO3\CMS\Core\Utility\PathUtility;
20 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
21 use TYPO3\CMS\Form\Mvc\Configuration\ConfigurationManagerInterface;
22
23 /**
24 * The abstract form backend controller
25 *
26 * Scope: backend
27 */
28 abstract class AbstractBackendController extends ActionController
29 {
30
31 /**
32 * @var array
33 */
34 protected $formSettings;
35
36 /**
37 * @var \TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManagerInterface
38 */
39 protected $formPersistenceManager;
40
41 /**
42 * @param \TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManagerInterface $formPersistenceManager
43 * @internal
44 */
45 public function injectFormPersistenceManager(\TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManagerInterface $formPersistenceManager)
46 {
47 $this->formPersistenceManager = $formPersistenceManager;
48 }
49
50 /**
51 * @internal
52 */
53 public function initializeObject()
54 {
55 $this->formSettings = $this->objectManager->get(ConfigurationManagerInterface::class)
56 ->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_YAML_SETTINGS, 'form');
57 }
58
59 /**
60 * Convert arrays with EXT: resource paths to web paths
61 *
62 * Input:
63 * [
64 * 100 => 'EXT:form/Resources/Public/Css/form.css'
65 * ]
66 *
67 * Output:
68 *
69 * [
70 * 0 => 'typo3/sysext/form/Resources/Public/Css/form.css'
71 * ]
72 *
73 * @param array $resourcePaths
74 * @return array
75 */
76 protected function resolveResourcePaths(array $resourcePaths): array
77 {
78 $return = [];
79 foreach ($resourcePaths as $resourcePath) {
80 $fullResourcePath = GeneralUtility::getFileAbsFileName($resourcePath);
81 $resourcePath = PathUtility::getAbsoluteWebPath($fullResourcePath);
82 if (empty($resourcePath)) {
83 continue;
84 }
85 $return[] = $resourcePath;
86 }
87
88 return $return;
89 }
90 }