From f2a9a6dc5ebd817c3769ade999196b6de183c76a Mon Sep 17 00:00:00 2001 From: Oliver Hader <oliver@typo3.org> Date: Sun, 25 Jul 2021 14:09:28 +0200 Subject: [PATCH] [TASK] Expose raw definition of backend layout model Allows to make use of custom properties in backend layouts, e.g. like shown below in Fluid templates: ``` <f:if condition="{column.definition.myFeature}"> <div data-colpos="{column.columnNumber}">...</div> </f:if> ``` Resolves: #94634 Releases: master Change-Id: I2dc2b7324bbcabc55a8896f74c3dd79768a0b87d Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70067 Tested-by: Oliver Bartsch <bo@cedev.de> Tested-by: core-ci <typo3@b13.com> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Oliver Bartsch <bo@cedev.de> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../View/BackendLayout/Grid/GridColumn.php | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumn.php b/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumn.php index 260686cf44e1..ed6fd1489f4e 100644 --- a/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumn.php +++ b/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumn.php @@ -69,14 +69,28 @@ class GridColumn extends AbstractGridObject */ protected $rowSpan = 1; - public function __construct(PageLayoutContext $context, array $columnDefinition) + /** + * @var array<string, mixed> + */ + protected $definition; + + public function __construct(PageLayoutContext $context, array $definition) { parent::__construct($context); - $this->columnNumber = isset($columnDefinition['colPos']) ? (int)$columnDefinition['colPos'] : null; - $this->columnName = $columnDefinition['name'] ?? $this->columnName; - $this->icon = $columnDefinition['icon'] ?? $this->icon; - $this->colSpan = (int)($columnDefinition['colspan'] ?? $this->colSpan); - $this->rowSpan = (int)($columnDefinition['rowspan'] ?? $this->rowSpan); + $this->definition = $definition; + $this->columnNumber = isset($definition['colPos']) ? (int)$definition['colPos'] : null; + $this->columnName = $definition['name'] ?? $this->columnName; + $this->icon = $definition['icon'] ?? $this->icon; + $this->colSpan = (int)($definition['colspan'] ?? $this->colSpan); + $this->rowSpan = (int)($definition['rowspan'] ?? $this->rowSpan); + } + + /** + * @return array<string, mixed> + */ + public function getDefinition(): array + { + return $this->definition; } public function isActive(): bool -- GitLab