Skip to content

Instantly share code, notes, and snippets.

@DavidBruchmann
Last active February 14, 2026 08:59
Show Gist options
  • Select an option

  • Save DavidBruchmann/e28b2a8841c66ddbbf75cccbf6e1b5d0 to your computer and use it in GitHub Desktop.

Select an option

Save DavidBruchmann/e28b2a8841c66ddbbf75cccbf6e1b5d0 to your computer and use it in GitHub Desktop.
TYPO3 CE Headerimage
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider;
use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider;
return [
'tx-sitepackage-ce-headerimage' => [
'provider' => SvgIconProvider::class,
'source' => 'EXT:sitepackage/Resources/Public/Icons/tx_sitepackage_ce_headerimage.svg',
],
];
<?php
defined('TYPO3') || die();
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
call_user_func(function() {
$GLOBALS['TCA']['tt_content']['types']['tx_sitepackage_headerimage']['showitem']
= '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general, '
. '--palette--;;basic_no_lang, '
. 'header;Name (not visible in frontend), '
. 'image,'
. $defaultTabs;
$extensionKey = 'sitepackage';
ExtensionManagementUtility::addPlugin([
'0' => 'HeaderImage Element',
'1' => 'tx_sitepackage_headerimage',
'2' => 'tx-sitepackage-ce-headerimage',
'3' => $groupID,
],
'CType',
$extensionKey
);
});
###################################################
#### HEADERIMAGE - Setup ##########################
#### This solution requires currently the patch on
#### https://forge.typo3.org/issues/100849
#### Date: 2023-05-10 ... 2023-12-08
###################################################
plugin.tx_sitepackage_headerimage = CONTENT
plugin.tx_sitepackage_headerimage {
table = tt_content
select {
// IMPORTANT:
// THIS `where` clause is messing up sorting and might prevent display completely
// at least in combination with `begin.dataWrap` below
## where = AND {#CType}="tx_sitepackage_hero"
orderBy = sorting
max = 1
begin.dataWrap = {cObj : parentRecordNumber} - 1
}
renderObj = COA
renderObj {
stdWrap {
## debugFunc = 2
## debugData = 1
## debug = 1
prefixComment = 2|Output of plugin.tx_sitepackage_headerimage.renderObj
}
20 = FILES
20 {
references {
table = tt_content
uid.field = uid
fieldName = image
}
renderObj = TEXT
renderObj {
data = file:current:publicUrl
stdWrap.noTrimWrap = |<div class="wf_landing_wrapper980"><div class="wf_landing_start" style="background-image: url(|)"></div></div>|
}
}
}
}
tt_content {
tx_sitepackage_headerimage < plugin.tx_sitepackage_headerimage
shortcut.variables.shortcuts.conf.tt_content {
tx_sitepackage_headerimage = COA
tx_sitepackage_headerimage {
10 < plugin.tx_sitepackage_headerimage.renderObj
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment