Files
VITEC-website/packages/vitec/Classes/Hook/SyncBackendLayoutHook.php
o-rasche bb7c03235d Checkpoint: headless JSON architecture documented + cleanup (Stufe 1+2)
Restore point before Stufe 3 (central resolver-service refactoring).

Includes this session's work:
- Success Story (usecase) rebuild: new fields/tabs, UsecaseSerializer,
  thin List/Show renderers, MM relations, inline content elements.
- vitec_columns content block (two-column layout with per-item content)
  incl. unified header section; special-cased JSON resolution.
- Container per-column flex (items[].config align/justify) + gap on parent.
- Unified header section across CEs/plugins/containers; header fields in JSON.
- ISO-style architecture spec: Documentation/Headless-JSON-Architecture.md.
- Cleanup: removed local scratch + verified .bak backups.
- Fixes: B-6 (undefined thumbnail variable in Downloadcardcollection image
  resolver), B-7 (unsatisfiable legacy CType OR branch in Downloadcard/Datasheets).

Rollback: git reset --hard snapshot-2026-07-09-pre-stufe3

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 10:01:56 +02:00

38 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace Evomedien\Vitec\Hook;
use TYPO3\CMS\Core\DataHandling\DataHandler;
/**
* Auto-syncs pages.backend_layout = "vitec_<N>" whenever pages.layout is saved.
* Also syncs backend_layout_next_level so subpages inherit the same layout
* (until they pick their own frontend layout).
*
* Hooked via $TYPO3_CONF_VARS[SC_OPTIONS][t3lib/class.t3lib_tcemain.php][processDatamapClass].
*/
final class SyncBackendLayoutHook
{
public function processDatamap_postProcessFieldArray(
string $status,
string $table,
$id,
array &$fieldArray,
DataHandler $pObj
): void {
if ($table !== 'pages') {
return;
}
if (!array_key_exists('layout', $fieldArray)) {
return;
}
$layoutValue = (int)$fieldArray['layout'];
$beIdentifier = 'vitec__' . $layoutValue;
$fieldArray['backend_layout'] = $beIdentifier;
$fieldArray['backend_layout_next_level'] = $beIdentifier;
}
}