Skip to content

Commit b1e3b4a

Browse files
committed
[WIP] backend template
1 parent c4f1987 commit b1e3b4a

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

Classes/Tca/ContainerConfiguration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ContainerConfiguration
4242
*/
4343
protected $icon = 'EXT:container/Resources/Public/Icons/Extension.svg';
4444

45-
protected ?string $backendTemplate = null;
45+
protected string $backendTemplate = 'EXT:container/Resources/Private/Templates/Container.html';
4646

4747
/**
4848
* @var string
@@ -228,7 +228,7 @@ public function getIcon(): string
228228
return $this->icon;
229229
}
230230

231-
public function getBackendTemplate(): ?string
231+
public function getBackendTemplate(): string
232232
{
233233
return $this->backendTemplate;
234234
}

Classes/Tca/Registry.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ public function configureContainer(ContainerConfiguration $containerConfiguratio
6464
$containerConfiguration->getGroup(),
6565
]
6666
);
67-
}
68-
69-
if ($containerConfiguration->getBackendTemplate() === null || (GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() === 11) {
7067
$GLOBALS['TCA']['tt_content']['types'][$containerConfiguration->getCType()]['previewRenderer'] = \B13\Container\Backend\Preview\ContainerPreviewRenderer::class;
7168
}
7269

@@ -268,12 +265,10 @@ public function getPageTsString(): string
268265
}
269266
$groupedByGroup[$group][$cType] = $containerConfiguration;
270267
}
271-
if ($containerConfiguration['backendTemplate'] !== null) {
272-
$pageTs .= LF . 'mod.web_layout.tt_content.preview {
268+
$pageTs .= LF . 'mod.web_layout.tt_content.preview {
273269
' . $cType . ' = ' . $containerConfiguration['backendTemplate'] . '
274270
}
275271
';
276-
}
277272
}
278273
$typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
279274
if ($typo3Version->getMajorVersion() > 12) {

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ This is an example to create a 2 column container. The code snippet goes into a
7171
| Method name | Description | Parameters | Default |
7272
| ----------- | ----------- | ---------- | ---------- |
7373
| `setIcon` | icon file, or existing icon identifier | `string $icon` | `'EXT:container/Resources/Public/Icons/Extension.svg'` |
74-
| `setBackendTemplate` | Template for backend view| `string $backendTemplate` | `null'` |
74+
| `setBackendTemplate` | Template for backend view| `string $backendTemplate` | `EXT:container/Resources/Private/Templates/Container.html'` |
7575
| `setGridTemplate` | Template for grid | `string $gridTemplate` | `'EXT:container/Resources/Private/Templates/Container.html'` |
7676
| `setGridPartialPaths` / `addGridPartialPath` | Partial root paths for grid | `array $gridPartialPaths` / `string $gridPartialPath` | `['EXT:backend/Resources/Private/Partials/', 'EXT:container/Resources/Private/Partials/']` |
7777
| `setGridLayoutPaths` | Layout root paths for grid | `array $gridLayoutPaths` | `[]` |
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<html
2+
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
3+
data-namespace-typo3-fluid="true"
4+
>
5+
<f:comment>
6+
note: the tx_container_grid variable not set for TYPO3 v11,
7+
in TYPO3 v11 the ContainerPreviewRenderer renders the container grid after content from StandardContentPreviewRenderer
8+
in TYPO3 > v11 this variable is assigned in PageContentPreviewRendering EventListener
9+
in this case of backendLayout is set, not ContainerPreviewRenderer is used
10+
</f:comment>
11+
<f:format.raw>{tx_container_grid}</f:format.raw>
12+
</html>

0 commit comments

Comments
 (0)