‪TYPO3CMS  ‪main
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 array ‪$rows = [];
44 
45  public function ‪addRow(‪GridRow $row): void
46  {
47  $this->rows[] = $row;
48  }
49 
53  public function ‪getRows(): iterable
54  {
55  return ‪$this->rows;
56  }
57 
58  public function ‪getColumns(): iterable
59  {
60  $columns = [];
61  foreach ($this->rows as $gridRow) {
62  $columns += $gridRow->getColumns();
63  }
64  return $columns;
65  }
66 
67  public function ‪getSpan(): int
68  {
69  if (!isset($this->rows[0]) || $this->context->getDrawingConfiguration()->isLanguageComparisonMode()) {
70  return 1;
71  }
72  $span = 0;
73  foreach ($this->rows[0]->‪getColumns() as $column) {
74  $span += $column->getColSpan();
75  }
76  return $span ?: 1;
77  }
78 }
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid
Definition: Grid.php:39
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid\getColumns
‪getColumns()
Definition: Grid.php:58
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\AbstractGridObject
Definition: AbstractGridObject.php:40
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\GridRow
Definition: GridRow.php:31
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid\getSpan
‪getSpan()
Definition: Grid.php:67
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid\getRows
‪GridRow[] getRows()
Definition: Grid.php:53
‪TYPO3\CMS\Backend\View\BackendLayout\Grid
Definition: AbstractGridObject.php:18
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid\addRow
‪addRow(GridRow $row)
Definition: Grid.php:45
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid\$rows
‪array $rows
Definition: Grid.php:43