[TASK] Expose raw definition of backend layout model
authorOliver Hader <oliver@typo3.org>
Sun, 25 Jul 2021 12:09:28 +0000 (14:09 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 29 Jul 2021 20:36:46 +0000 (22:36 +0200)
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>
typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumn.php

index 260686c..ed6fd14 100644 (file)
@@ -69,14 +69,28 @@ class GridColumn extends AbstractGridObject
      */
     protected $rowSpan = 1;
 
      */
     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);
     {
         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
     }
 
     public function isActive(): bool