Commit f2a9a6dc authored by Oliver Hader's avatar Oliver Hader Committed by Christian Kuhn
Browse files

[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's avatarOliver Bartsch <bo@cedev.de>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent b3187510
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment