Files
VITEC-website/packages/vitec/Classes/Hook/SyncBackendLayoutHook.php
o-rasche 409afc2433 VITEC headless: ContentElementResolver, Product fields (videofile, showdatapath)
- New Classes/Service/ContentElementResolver.php: parses TYPO3 typolink
  (t3://record?identifier=tt_content&uid=N, t3://page?uid=P#N, plain numeric)
  to a normalised tt_content envelope ({id,type,colPos,sorting,appearance,
  data}), recursively resolving any nested VITEC list-plugin children.
- ProductListJsonRenderer / ProductShowJsonRenderer: contentelement and
  contentelementcta now emit the resolved object instead of the raw
  typolink string (breaking change at those two keys).
- Product model: new field videofile (FAL, single video upload in tab
  Images and Videos, mp4/webm/ogv/mov/m4v); new bool field showdatapath
  (toggle at end of General tab, controls the "Datapath is now Vitec"
  graphic in the frontend). ext_tables.sql, TCA, model property +
  getter/setter, and both renderers updated accordingly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-05 10:34:49 +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;
}
}