f708669f5221074df303f51d126670071323fbe9
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Configuration / Source / TX_EXTMVC_Configuration_Source_FlexForm.php
1 <?php
2
3 /* *
4 * This script is part of the TYPO3 project - inspiring people to share! *
5 * *
6 * TYPO3 is free software; you can redistribute it and/or modify it under *
7 * the terms of the GNU General Public License version 2 as published by *
8 * the Free Software Foundation. *
9 * *
10 * This script is distributed in the hope that it will be useful, but *
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
12 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
13 * Public License for more details. *
14 * */
15
16 /**
17 * Configuration source based on FlexForm settings
18 *
19 * @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
20 */
21 class TX_EXTMVC_Configuration_Source_FlexForm implements TX_EXTMVC_Configuration_SourceInterface {
22
23 /**
24 * XML FlexForm content
25 *
26 * @var string
27 **/
28 protected $flexFormContent;
29
30 /**
31 * Sets the flex form content
32 *
33 * @param string $flexFormContent Flexform content
34 * @return void
35 */
36 public function setFlexFormContent($flexFormContent) {
37 $this->flexFormContent = $flexFormContent;
38 }
39
40 // SK: Change Doc comment
41 /**
42 * Loads the specified TypoScript configuration file and returns its content in a
43 * configuration container. If the file does not exist or could not be loaded,
44 * the empty configuration container is returned.
45 *
46 * @param string $extensionKey The extension key
47 * @return TX_EXTMVC_Configuration_Container
48 */
49 public function load($extensionKey) {
50 $settings = array();
51 // SK. I'd say this does not work in case $this->flexFormContent IS already an array. Can this happen?
52 if (!is_array($this->flexFormContent) && $this->flexFormContent) {
53 $flexFormArray = t3lib_div::xml2array($this->flexFormContent);
54 }
55 $sheetArray = $flexFormArray['data']['sDEF']['lDEF'];
56 if (is_array($sheetArray)) {
57 foreach($sheetArray as $key => $value) {
58 $settings[$key] = $value['vDEF'];
59 }
60 }
61 return $settings;
62 }
63
64 }
65 ?>