[TASK] FAL: Hard-coded flexform on storage creation
authorBenjamin Mack <benni@typo3.org>
Tue, 9 Oct 2012 14:20:18 +0000 (16:20 +0200)
committerSteffen Ritter <info@rs-websystems.de>
Wed, 10 Oct 2012 14:16:50 +0000 (16:16 +0200)
The StorageRepository creates FlexForm not through
the API calls, but with a static string. The attached
patch changes this.

Change-Id: Iba4fb6bb534c58755b10d69ee31b8bee57c45f1f
Resolves: #41716
Releases: 6.0
Reviewed-on: http://review.typo3.org/15444
Reviewed-by: Dmitry Dulepov
Tested-by: Dmitry Dulepov
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/core/Classes/Resource/StorageRepository.php

index 9a4eff8..14a63a6 100644 (file)
@@ -151,6 +151,24 @@ class StorageRepository extends \TYPO3\CMS\Core\Resource\AbstractRepository {
         * @return integer uid of the inserted record
         */
        public function createLocalStorage($name, $basePath, $pathType, $description = '') {
+
+                       // create the FlexForm for the driver configuration
+               $flexFormData = array(
+                       'data' => array(
+                               'sDEF' => array(
+                                       'lDEF' => array(
+                                               'basePath' => array('vDEF' => rtrim($basePath, '/') . '/'),
+                                               'pathType' => array('vDEF' => $pathType)
+                                       )
+                               )
+                       )
+               );
+
+               /** @var $flexObj \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools */
+               $flexObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\FlexForm\\FlexFormTools');
+               $flexFormXml = $flexObj->flexArray2Xml($flexFormData, TRUE);
+
+                       // create the record
                $field_values = array(
                        'pid' => 0,
                        'tstamp' => $GLOBALS['EXEC_TIME'],
@@ -158,21 +176,7 @@ class StorageRepository extends \TYPO3\CMS\Core\Resource\AbstractRepository {
                        'name' => $name,
                        'description' => $description,
                        'driver' => 'Local',
-                       'configuration' => '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-                               <T3FlexForms>
-                                       <data>
-                                               <sheet index="sDEF">
-                                                       <language index="lDEF">
-                                                               <field index="basePath">
-                                                                       <value index="vDEF">' . rtrim($basePath, '/') . '/</value>
-                                                               </field>
-                                                               <field index="pathType">
-                                                                       <value index="vDEF">' . $pathType . '</value>
-                                                               </field>
-                                                       </language>
-                                               </sheet>
-                                       </data>
-                               </T3FlexForms>',
+                       'configuration' => $flexFormXml,
                        'is_online' => 1,
                        'is_browsable' => 1,
                        'is_public' => 1,
@@ -211,4 +215,4 @@ class StorageRepository extends \TYPO3\CMS\Core\Resource\AbstractRepository {
 }
 
 
-?>
\ No newline at end of file
+?>