‪TYPO3CMS  10.4
Grid.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
39 {
43  protected ‪$rows = [];
44 
48  protected ‪$allowNewContent = true;
49 
50  public function ‪addRow(‪GridRow $row): void
51  {
52  $this->rows[] = $row;
53  }
54 
58  public function ‪getRows(): iterable
59  {
60  return ‪$this->rows;
61  }
62 
63  public function ‪getColumns(): iterable
64  {
65  $columns = [];
66  foreach ($this->rows as $gridRow) {
67  $columns += $gridRow->getColumns();
68  }
69  return $columns;
70  }
71 
72  public function ‪getSpan(): int
73  {
74  if (!isset($this->rows[0]) || $this->context->getDrawingConfiguration()->getLanguageMode()) {
75  return 1;
76  }
77  $span = 0;
78  foreach ($this->rows[0]->‪getColumns() ?? [] as $column) {
79  $span += $column->getColSpan();
80  }
81  return $span ?: 1;
82  }
83 }
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid
Definition: Grid.php:39
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid\getColumns
‪getColumns()
Definition: Grid.php:61
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\AbstractGridObject
Definition: AbstractGridObject.php:41
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\GridRow
Definition: GridRow.php:31
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid\getSpan
‪getSpan()
Definition: Grid.php:70
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid\$rows
‪GridRow[] $rows
Definition: Grid.php:42
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid\getRows
‪GridRow[] getRows()
Definition: Grid.php:56
‪TYPO3\CMS\Backend\View\BackendLayout\Grid
Definition: AbstractGridObject.php:18
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid\addRow
‪addRow(GridRow $row)
Definition: Grid.php:48
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid\$allowNewContent
‪bool $allowNewContent
Definition: Grid.php:46