|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace B13\Container\Domain\Core; |
| 6 | + |
| 7 | +/* |
| 8 | + * This file is part of TYPO3 CMS-based extension "container" by b13. |
| 9 | + * |
| 10 | + * It is free software; you can redistribute it and/or modify it under |
| 11 | + * the terms of the GNU General Public License, either version 2 |
| 12 | + * of the License, or any later version. |
| 13 | + */ |
| 14 | + |
| 15 | +use TYPO3\CMS\Core\Domain\RawRecord; |
| 16 | +use TYPO3\CMS\Core\Domain\Record; |
| 17 | +use TYPO3\CMS\Core\Domain\Record\ComputedProperties; |
| 18 | +use TYPO3\CMS\Core\Domain\Record\LanguageInfo; |
| 19 | +use TYPO3\CMS\Core\Domain\Record\SystemProperties; |
| 20 | +use TYPO3\CMS\Core\Domain\Record\VersionInfo; |
| 21 | +use TYPO3\CMS\Core\Domain\RecordInterface; |
| 22 | + |
| 23 | +class RecordWithRenderedGrid implements RecordInterface |
| 24 | +{ |
| 25 | + public function __construct( |
| 26 | + protected readonly Record $coreRecord, |
| 27 | + protected readonly ?string $renderedGrid |
| 28 | + ) { |
| 29 | + } |
| 30 | + |
| 31 | + public function getUid(): int |
| 32 | + { |
| 33 | + return $this->coreRecord->getRawRecord()->getUid(); |
| 34 | + } |
| 35 | + |
| 36 | + public function getPid(): int |
| 37 | + { |
| 38 | + return $this->coreRecord->getRawRecord()->getPid(); |
| 39 | + } |
| 40 | + |
| 41 | + public function getFullType(): string |
| 42 | + { |
| 43 | + return $this->coreRecord->getRawRecord()->getFullType(); |
| 44 | + } |
| 45 | + |
| 46 | + public function getRecordType(): ?string |
| 47 | + { |
| 48 | + return $this->coreRecord->getRawRecord()->getRecordType(); |
| 49 | + } |
| 50 | + |
| 51 | + public function getMainType(): string |
| 52 | + { |
| 53 | + return $this->coreRecord->getRawRecord()->getMainType(); |
| 54 | + } |
| 55 | + |
| 56 | + public function toArray(bool $includeSystemProperties = false): array |
| 57 | + { |
| 58 | + $properties = $this->coreRecord->toArray(); |
| 59 | + $properties['tx_container_grid'] = $this->renderedGrid; |
| 60 | + return $properties; |
| 61 | + } |
| 62 | + |
| 63 | + public function has(string $id): bool |
| 64 | + { |
| 65 | + if ($id === 'tx_container_grid') { |
| 66 | + return true; |
| 67 | + } |
| 68 | + return $this->coreRecord->has($id); |
| 69 | + } |
| 70 | + |
| 71 | + public function get(string $id): mixed |
| 72 | + { |
| 73 | + if ($id === 'tx_container_grid') { |
| 74 | + return $this->renderedGrid; |
| 75 | + } |
| 76 | + return $this->coreRecord->get($id); |
| 77 | + } |
| 78 | + |
| 79 | + public function getVersionInfo(): ?VersionInfo |
| 80 | + { |
| 81 | + return $this->coreRecord->getVersionInfo(); |
| 82 | + } |
| 83 | + |
| 84 | + public function getLanguageInfo(): ?LanguageInfo |
| 85 | + { |
| 86 | + return $this->coreRecord->getLanguageInfo(); |
| 87 | + } |
| 88 | + |
| 89 | + public function getLanguageId(): ?int |
| 90 | + { |
| 91 | + return $this->coreRecord->getLanguageId(); |
| 92 | + } |
| 93 | + |
| 94 | + public function getSystemProperties(): ?SystemProperties |
| 95 | + { |
| 96 | + return $this->coreRecord->getSystemProperties(); |
| 97 | + } |
| 98 | + |
| 99 | + public function getComputedProperties(): ComputedProperties |
| 100 | + { |
| 101 | + return $this->coreRecord->getComputedProperties(); |
| 102 | + } |
| 103 | + |
| 104 | + public function getRawRecord(): RawRecord |
| 105 | + { |
| 106 | + return $this->coreRecord->getRawRecord(); |
| 107 | + } |
| 108 | + |
| 109 | + public function getOverlaidUid(): int |
| 110 | + { |
| 111 | + return $this->coreRecord->getOverlaidUid(); |
| 112 | + } |
| 113 | +} |
0 commit comments