12. May 2018
Fluid Content Content elements without EXT:fluidcontent
Flexible content elements in TYPO3 based on fluid files could be developed with EXT:fluid and EXT:fluidcontent. The latter can now be saved.
We are big fans of the TYPO3 Templating Engine Fluid. Together with the extensions EXT:flux and EXT:fluidcontent you can use it to create flexible content elements for your editors very quickly, which are exactly tailored to the individual use cases. From a developer's point of view, this is particularly convenient because only one technology is needed, namely Fluid Markup. Furthermore, no php classes, TCA configuration, Typoscript, Page TSconfig or SQL definitions are necessary. A further advantage is that only 1 file with the Fluid Markup is required per element and no database entries in the CMS. This makes content elements based on EXT:flux and EXT:fluidcontent very portable and easy to version and deploy. More about the technology can be found at https://fluidtypo3.org/documentation/templating-manual/templating/creating-templates/content-element.html.
Now in version 8.0.0 of EXT:flux it was announced that the whole thing can be achieved without EXT:fluidcontent. Here we will show you how to free an existing project from EXT.fluidcontent and make its content elements available only with EXT:flux. In the following code examples we assume that all elements are bundled in a provider or sitepackage extension "EXT:template" with the vendor name AEMKA. As with any system technical intervention, we recommend a backup of the file system and database of the TYPO3 installation in advance. It was tested with version 8.2.1 of EXT:flux and TYPO3 CMS 8.7.13.
To do so, remove the dependency on EXT:fluidcontent in EXT:template/ext_emconf.php in $EM_CONF[$_EXTKEY]['constraints']['depends']. Afterwards EXT:fluidcontent can be uninstalled in the TYPO3 Extension Manager and deleted directly if necessary.
For each content element in EXT:template/Resources/Private/Templates/Content/ one more line of code must be created in EXT:template/ext_localconf.php. But this will probably become unnecessary and completely automated later on, in the latest Github master version of EXT:flux it is already the case:
\FluidTYPO3\Flux\Core::registerTemplateAsContentType( 'AEMKA.Template', 'EXT:template/Resources/Private/Templates/Content/SomeElement.html' ); \FluidTYPO3\Flux\Core::registerTemplateAsContentType( 'AEMKA.Template', 'EXT:template/Resources/Private/Templates/Content/AnotherElement.html' ); ...
For each content element that you have already created with EXT:fluidcontent and want to migrate, you must execute an SQL command of the following type
UPDATE tt_content SET CType = "template_someelement" WHERE tx_fed_fcefile = "AEMKA.Template:SomeElement.html" AND CType = "fluidcontent_content"; UPDATE tt_content SET CType = "template_anotherelement" WHERE tx_fed_fcefile = "AEMKA.Template:AnotherElement.html" AND CType = "fluidcontent_content"; ...
In addition, the editor rights may now have to be adjusted, since the content element types with which the editor rights were previously set up have all changed.
In the TYPO3 Install Tool under "Important actions" > "Compare current database with specification" the now unnecessary database columns can be removed.
Per element you can now reliably assign an icon with the markup:
<flux:form.option.icon value="EXT:template/Resources/Public/Icons/Content/Icon.svg" />
within the flux:form tag.
In version 8 of Flux we received a message in the frontend that the Flux content elements could not be rendered. With the following lines in ext_localconf.php we could remedy this. Whether this was a general problem and whether this will still be necessary in version 9 of Flux, we cannot say at the moment:
if (TYPO3_MODE == 'FE') { $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['includeStaticTypoScriptSources'][] = \FluidTYPO3\Flux\Backend\TableConfigurationPostProcessor::class . '->processData'; }
If you had a php controller class that prepared data for EXT:fluidcontent before rendering, you may need to change the class name your content controller inherits from before removing EXT:fluidcontent:
class ContentController extends \FluidTYPO3\Fluidcontent\Controller\AbstractContentController
tp
class ContentController extends \FluidTYPO3\Flux\Controller\ContentController
You can save an extension in the system. In addition, the development of EXT:fluidcontent has also been stopped and should no longer be available for TYPO3 CMS 9, so it is also a further preparatory step for the update to the upcoming LTS version of TYPO3 CMS.
With the changeover some small bugs are history, e.g. the problems with disappearing icons of the elements. In addition, each content element now has its own content element type (CType), so that you can now explicitly define in editor rights that editors only have access to certain elements, as well as that only certain content elements are allowed in container elements.
If you need technical support, training or other TYPO3 services get in touch with us.
There is also another article on this topic:
Fluid Pages Page Layouts without EXT:fluidpages