TypoScript::fromString()
\nn\t3::TypoScript()->fromString($str = '', $overrideSetup = []);
Converts a text into a TypoScript array.
$example = '
lib.test {
someVal = 10
}
';
\nn\t3::TypoScript()->fromString($example); => ['lib'=>['test'=>['someVal'=>10]]]
\nn\t3::TypoScript()->fromString($example, $mergeSetup); => ['lib'=>['test'=>['someVal'=>10]]]
Copied!
| @return array
Source Code
public function fromString ( $str = '', $overrideSetup = [] ) {
if (!trim($str)) return $overrideSetup;
$typoScriptStringFactory = GeneralUtility::makeInstance( TypoScriptStringFactory::class );
$rootNode = $typoScriptStringFactory->parseFromStringWithIncludes('nnhelpers-fromstring', $str);
$setup = $rootNode->toArray();
if ($overrideSetup) {
$setup = array_replace_recursive($overrideSetup, $setup);
}
return $this->convertToPlainArray($setup);
}
Copied!