Skip to content
Open
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
30 changes: 30 additions & 0 deletions Classes/Backend/Grid/ContainerGrid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace B13\Container\Backend\Grid;

/*
* This file is part of TYPO3 CMS-based extension "container" by b13.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*/

use TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid;

class ContainerGrid extends Grid
{
public function getSpan(): int
{
if (!isset($this->rows[0])) {
return 1;
}
$span = 0;
foreach ($this->rows[0]->getColumns() as $column) {
$span += $column->getColSpan();
}
return $span ?: 1;
}
}
10 changes: 10 additions & 0 deletions Classes/Backend/Grid/ContainerGridColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,14 @@ public function getNewContentUrl(): string
}
return $this->newContentUrl;
}

public function getColSpan(): int
{
return $this->colSpan;
}

public function getRowSpan(): int
{
return $this->rowSpan;
}
}
4 changes: 2 additions & 2 deletions Classes/Backend/Preview/GridRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* of the License, or any later version.
*/

use B13\Container\Backend\Grid\ContainerGrid;
use B13\Container\Backend\Grid\ContainerGridColumn;
use B13\Container\Backend\Grid\ContainerGridColumnItem;
use B13\Container\Backend\Service\NewContentUrlBuilder;
Expand All @@ -21,7 +22,6 @@
use B13\Container\Tca\Registry;
use Psr\EventDispatcher\EventDispatcherInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid;
use TYPO3\CMS\Backend\View\BackendLayout\Grid\GridRow;
use TYPO3\CMS\Backend\View\PageLayoutContext;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
Expand All @@ -43,7 +43,7 @@ public function __construct(

public function renderGrid(array $record, PageLayoutContext $context): string
{
$grid = GeneralUtility::makeInstance(Grid::class, $context);
$grid = GeneralUtility::makeInstance(ContainerGrid::class, $context);
try {
$container = $this->containerFactory->buildContainer((int)$record['uid']);
} catch (Exception $e) {
Expand Down