Initial Commit
This commit is contained in:
1 parent
4f495177e4
commit
b6d2142214
166 files changed
+13952
-178
No files matched your search
+37
@@ -0,0 +1,37 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user