5.3.2 Migration to Flux 7.0
Users of TYPO3 6.1.7 or below will experience problems upgrading Flux and using the ViewHelpers it includes. The reason is a bug in the TYPO3 core itself which prevents aliased ViewHelper classes from working correctly: http://forge.typo3.org/issues/54115. Users of TYPO3 6.1.8 or above are completely unaffected by this issue.
If you are on a 6.1.7 or below and must upgrade Flux but cannot upgrade the core itself (which is of course the recommended thing to do, upgrading the core itself) you can manually add the missing code line in the TYPO3 source code, as described in this link:
https://review.typo3.org/#/c/25814/9/typo3/sysext/fluid/Classes/Core/Parser/TemplateParser.php
New ViewHelper Names
To migrate your templates, change every occurence of the following ViewHelpers (see script below - no need to do this by hand)
flux:flexformtoflux:formflux:flexform.gridtoflux:gridflux:flexform.grid.columntoflux:grid.columnflux:flexform.grid.rowtoflux:grid.rowflux:flexform.containertoflux:form.containerflux:flexform.datatoflux:form.dataflux:flexform.objecttoflux:form.objectflux:flexform.sectiontoflux:form.sectionflux:flexform.sheettoflux:form.sheetflux:flexform.field.wizard.addtoflux:wizard.addflux:flexform.field.wizard.colorPickertoflux:wizard.colorPickerflux:flexform.field.wizard.edittoflux:wizard.editflux:flexform.field.wizard.linktoflux:wizard.linkflux:flexform.field.wizard.listtoflux:wizard.listflux:flexform.field.wizard.selecttoflux:wizard.selectflux:flexform.field.wizard.slidertoflux:wizard.sliderflux:flexform.field.wizard.suggesttoflux:wizard.suggestflux:flexform.field.checkboxtoflux:field.checkboxflux:flexform.field.controllerActionstoflux:field.controllerActionsflux:flexform.field.customtoflux:field.customflux:flexform.field.filetoflux:field.fileflux:flexform.field.inlinetoflux:field.inlineflux:flexform.field.inline.faltoflux:field.inline.falflux:flexform.field.inputtoflux:field.inputflux:flexform.field.relationtoflux:field.relationflux:flexform.field.selecttoflux:field.selectflux:flexform.field.texttoflux:field.textflux:flexform.field.treetoflux:field.treeflux:flexform.field.userFunctoflux:field.userFuncflux:flexform.contenttoflux:form.contentflux:flexform.renderContenttoflux:content.render
And make sure you change the Flux namespace inclusion in all templates as well:
{namespace flux=Tx_Flux_ViewHelpers}to{namespace flux=FluidTYPO3\Flux\ViewHelpers}
This can be done automatically using the following script:
Use at your own risk, change $directory
<?php
$directory = '/Users/danilo/Sites/hmspl/typo3conf/ext/';
$replaceNamespaces = array(
'{namespace flux=Tx_Flux_ViewHelpers}' => '{namespace flux=FluidTYPO3\Flux\ViewHelpers}',
);
$replaceViewHelpers = array(
'flux:flexform' => 'flux:form',
'flux:flexform.grid' => 'flux:grid',
'flux:flexform.grid.column' => 'flux:grid.column',
'flux:flexform.grid.row' => 'flux:grid.row',
'flux:flexform.container' => 'flux:form.container',
'flux:flexform.data' => 'flux:form.data',
'flux:flexform.object' => 'flux:form.object',
'flux:flexform.section' => 'flux:form.section',
'flux:flexform.sheet' => 'flux:form.sheet',
'flux:flexform.field.wizard.add' => 'flux:wizard.add',
'flux:flexform.field.wizard.colorPicker' => 'flux:wizard.colorPicker',
'flux:flexform.field.wizard.edit' => 'flux:wizard.edit',
'flux:flexform.field.wizard.link' => 'flux:wizard.link',
'flux:flexform.field.wizard.list' => 'flux:wizard.list',
'flux:flexform.field.wizard.select' => 'flux:wizard.select',
'flux:flexform.field.wizard.slider' => 'flux:wizard.slider',
'flux:flexform.field.wizard.suggest' => 'flux:wizard.suggest',
'flux:flexform.field.checkbox' => 'flux:field.checkbox',
'flux:flexform.field.controllerActions' => 'flux:field.controllerActions',
'flux:flexform.field.custom' => 'flux:field.custom',
'flux:flexform.field.file' => 'flux:field.file',
'flux:flexform.field.inline' => 'flux:field.inline',
'flux:flexform.field.inline.fal' => 'flux:field.inline.fal',
'flux:flexform.field.input' => 'flux:field.input',
'flux:flexform.field.relation' => 'flux:field.relation',
'flux:flexform.field.select' => 'flux:field.select',
'flux:flexform.field.text' => 'flux:field.text',
'flux:flexform.field.tree' => 'flux:field.tree',
'flux:flexform.field.userFunc' => 'flux:field.userFunc',
'flux:flexform.content' => 'flux:form.content',
'flux:flexform.renderContent' => 'flux:content.render',
);
die('MAKE A DAMN BACKUP, YOU COWBOY!' . PHP_EOL);
$dir = new RecursiveDirectoryIterator($directory);
$ite = new RecursiveIteratorIterator($dir);
foreach($ite as $file) {
if ('html' !== $file->getExtension()) {
continue;
}
$content = file_get_contents($file->getPathname());
$hasNamespace = FALSE;
foreach ($replaceNamespaces as $oldNamespace => $newNamespace) {
if (FALSE === strpos($content, $oldNamespace)) {
continue;
}
$hasNamespace = TRUE;
$content = str_replace($oldNamespace, $newNamespace, $content);
}
if (FALSE === $hasNamespace) {
continue;
}
foreach ($replaceViewHelpers as $oldViewHelper => $newViewHelper) {
$newViewHelper = str_replace('$', '\\$', $newViewHelper);
$content = preg_replace('/<(\/?)' . preg_quote($oldViewHelper) . '([\s\/>])/', '<$1' . $newViewHelper . '$2', $content);
}
file_put_contents($file->getPathname(), $content);
print_r('Modified ' . $file->getFilename() . PHP_EOL);
}
?>