Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Classes/Tca/ContainerConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ContainerConfiguration
protected string $description = '';
protected array $grid = [];
protected string $icon = 'EXT:container/Resources/Public/Icons/Extension.svg';
protected string $backendTemplate = 'EXT:container/Resources/Private/Templates/Container.html';
protected ?string $backendTemplate = 'EXT:container/Resources/Private/Templates/Container.html';
protected string $gridTemplate = 'EXT:container/Resources/Private/Templates/Grid.html';
protected array $gridPartialPaths = [
'EXT:backend/Resources/Private/Partials/',
Expand Down Expand Up @@ -51,7 +51,7 @@ public function setIcon(string $icon): ContainerConfiguration
return $this;
}

public function setBackendTemplate(string $backendTemplate): ContainerConfiguration
public function setBackendTemplate(?string $backendTemplate): ContainerConfiguration
{
$this->backendTemplate = $backendTemplate;
return $this;
Expand Down Expand Up @@ -147,11 +147,17 @@ public function getIcon(): string
return $this->icon;
}

public function getBackendTemplate(): string
public function getBackendTemplate(): ?string
{
return $this->backendTemplate;
}

public function disableBackendTemplate(): ContainerConfiguration
{
$this->backendTemplate = null;
return $this;
}

public function isRegisterInNewContentElementWizard(): bool
{
return $this->registerInNewContentElementWizard;
Expand Down
4 changes: 3 additions & 1 deletion Classes/Tca/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,12 @@ public function getPageTsString(): string
$defaultGroup = 'container';
$cTypesExcludedInNewContentElementWizard = [];
foreach ($GLOBALS['TCA']['tt_content']['containerConfiguration'] as $cType => $containerConfiguration) {
$pageTs .= chr(10) . 'mod.web_layout.tt_content.preview {
if ($containerConfiguration['backendTemplate'] !== null) {
$pageTs .= chr(10) . 'mod.web_layout.tt_content.preview {
' . $cType . ' = ' . $containerConfiguration['backendTemplate'] . '
}
';
}
// s. https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.0/Breaking-102834-RemoveItemsFromNewContentElementWizard.html
if ($containerConfiguration['registerInNewContentElementWizard'] === false) {
$group = $containerConfiguration['group'] !== '' ? $containerConfiguration['group'] : $defaultGroup;
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ This is an example of creating a two-column container. The code snippet goes int
| Method name | Description | Parameters | Default |
| ----------- | ----------- | ---------- | ---------- |
| `setIcon` | icon file, or existing icon identifier | `string $icon` | `'EXT:container/Resources/Public/Icons/Extension.svg'` |
| `setBackendTemplate` | Template for backend view| `string $backendTemplate` | `EXT:container/Resources/Private/Templates/Container.html'` |
| `setBackendTemplate` | Template for backend view| `?string $backendTemplate` | `EXT:container/Resources/Private/Templates/Container.html'` |
| `disableBackendTemplate` | Disables the backend template for this CType (shortcut for `setBackendTemplate(null)`), if you want another preview mechanism (e.g. EXT:backenlayout) | - | - |
| `setGridTemplate` | Template for grid | `string $gridTemplate` | `'EXT:container/Resources/Private/Templates/Grid.html'` |
| `setGridPartialPaths` / `addGridPartialPath` | Partial root paths for grid | `array $gridPartialPaths` / `string $gridPartialPath` | `['EXT:backend/Resources/Private/Partials/', 'EXT:container/Resources/Private/Partials/']` |
| `setGridLayoutPaths` | Layout root paths for grid | `array $gridLayoutPaths` | `[]` |
Expand Down