Content Blocks for v12 

With the release of Content Blocks 1.0.0 some things changed under the hood, which require migration in your Fluid templates. Also, the folder structure changed as well as usage of ViewHelpers.

New composer name 

The composer name has changed.

contentblocks/content-blocks ➡️ friendsoftypo3/content-blocks

Please migrate, as the old package is abandoned.

New folder structure 

There is a migration wizard to rename your Content Blocks folders and files to the new structure.

typo3 upgrade:run contentBlocksFolderStructureMigration
Copied!

Ensure the extension with the old Content Block structure is loaded in the system before running this wizard.

New AssetPathViewHelper 

We replaced the custom AssetViewHelpers with a new AssetPathViewHelper. Now you can use the Core AssetViewHelpers and only use the custom ViewHelpers to build the path to your asset.

<!-- Before -->
<cb:asset.css identifier="cbAccordionCssBackend" file="EditorPreview.css"/>

<!-- After -->
<f:asset.css identifier="cbAccordionCssBackend" href="{cb:assetPath()}/EditorPreview.css"/>
Copied!

New LanguagePathViewHelper 

We replaced the custom TranslateViewHelper with a new LanguagePathViewHelper that is used to build the translation key.

<!-- Before -->
<cb:translate key="readmore"/>

<!-- After -->
<f:translate key="{cb:languagePath()}:readmore"/>
Copied!

Record object 

Content Blocks now uses the \TYPO3\CMS\Core\Domain\Record under the hood. This has changed how some record attributes are accessed.

  • {data._raw} ➡️ {data.rawRecord}
  • {data.typeName} ➡️ {data.recordType}
  • {data.tableName} ➡️ {data.mainType}
  • {data.creationDate} ➡️ {data.systemProperties.createdAt}
  • {data.updateDate} ➡️ {data.systemProperties.lastUpdatedAt}
  • {data.localizedUid} ➡️ {data.computedProperties.localizedUid}

Data processing 

Content Blocks now uses the \TYPO3\CMS\Frontend\DataProcessing\RecordTransformationProcessor under the hood. This has changed how some fields are transformed.

Folder 

The type Folder field will now resolve to a list of \TYPO3\CMS\Core\Resource\Folder objects.

<!-- Before -->
<f:for each="{data.folder}" as="folder">
    <f:for each="{folder}" as="image">
        <f:image image="{item}" />
    </f:for>
</f:for>


<!-- After -->
<f:for each="{data.folder}" as="folder">
    <f:for each="{folder.files}" as="image">
        <f:image image="{item}" />
    </f:for>
</f:for>
Copied!

FlexForm 

New: Sub-fields of type FlexForm are now resolved as well.

Groups 

The property group now works for both the NewContentElementWizard and for the record selector in the edit view. With this, the way to register groups has changed.

Before:

EXT:my_package/Configuration/page.tsconfig
mod.wizards.newContentElement.wizardItems {
    my_group {
        header = LLL:EXT:my_package/Resources/Private/Language/Backend.xlf:content_group.my_group
        before = common
    }
}
Copied!

After:

EXT:my_package/Configuration/TCA/Overrides/tt_content.php
<?php

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItemGroup(
    'tt_content', // table
    'CType', // typeField
    'my_group', // group
    'LLL:EXT:my_package/Resources/Private/Language/Backend.xlf:content_group.my_group', // label
    'before:default', // position
);
Copied!

Public assets 

The assets folder of your Content Block is now symlinked to the extension's Resources/Public/ContentBlocks/* folder.