|
|
@@ -0,0 +1,33 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace Opentalent\OtTemplating\XClass\Form\Configuration;
|
|
|
+
|
|
|
+use Opentalent\OtCore\Page\OtPageRepository;
|
|
|
+use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
|
+use TYPO3\CMS\Extbase\Object\ObjectManager;
|
|
|
+
|
|
|
+class ConfigurationManager extends \TYPO3\CMS\Form\Mvc\Configuration\ConfigurationManager
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * Override the default form configuration loader to add the forms directory matching
|
|
|
+ * the current be user mounted organization(s) id(s)
|
|
|
+ *
|
|
|
+ * @param string $extensionName
|
|
|
+ * @return array
|
|
|
+ * @throws \TYPO3\CMS\Form\Mvc\Configuration\Exception\ExtensionNameRequiredException
|
|
|
+ */
|
|
|
+ protected function getConfigurationFromYamlFile(string $extensionName): array
|
|
|
+ {
|
|
|
+ $settings = parent::getConfigurationFromYamlFile($extensionName);
|
|
|
+
|
|
|
+ $otPageRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(OtPageRepository::class);
|
|
|
+ foreach ($otPageRepository->getCurrentBeUserMountpoints() as $rootUid) {
|
|
|
+ $organizationId = $otPageRepository->getPage($rootUid)['tx_opentalent_structure_id'];
|
|
|
+ if ($organizationId) {
|
|
|
+ $settings['persistenceManager']['allowedFileMounts'][] = '1:/form_definitions/' . $organizationId . '/';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $settings;
|
|
|
+ }
|
|
|
+}
|