Skip to content

Instantly share code, notes, and snippets.

@josefglatz
Last active September 29, 2016 11:13
Show Gist options
  • Save josefglatz/bdf10508e453bd01a8275b64b398de9d to your computer and use it in GitHub Desktop.
Save josefglatz/bdf10508e453bd01a8275b64b398de9d to your computer and use it in GitHub Desktop.
Simple Custom TYPO3 CE
// PageTSConfig
mod.wizards.newContentElement.wizardItems {
homepage {
header = Homepage
show = *
elements {
theme-sujet {
title = Big Sujet
description = Main sujet with slider images
tt_content_defValues {
CType = theme_sujet
}
}
}
}
}
<!-- the fluid template where you can do what you want. You can use {data} array and {sliderImages} -->
<html data-namespace-typo3-fluid="true"
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">
<figure>
<div id="swiper">
<div class="swiper-wrapper">
<f:for each="{sliderImages}" as="item">
<div class="swiper-slide"><f:image image="{item}" alt="" /></div>
</f:for>
</div>
</div>
<figcaption>
<h1>{data.header}</h1><br>
<h2>{data.subheader}</h2><br>
lalelu
</figcaption>
<span class="arrow"><a href="#anker"><i class="icon icon-arrow-down2"></i></a></span>
</figure>
<a name="anker"></a>
</html>
<?php
defined('TYPO3_MODE') || die('Access denied.');
call_user_func(
function ($extKey) {
// CE Sujet
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(
[
'Sujet',
'theme_sujet',
'theme-ce-sujet'
],
'CType',
'theme'
);
$tca = [
'types' => [
'theme_sujet' => [
'showitem' => '
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
header,
subheader,
image;Slider Images,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.visibility;visibility,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.extended,
',
'columnsOverrides' => [
'header' => [
'config' => [
'eval' => 'required'
]
],
'subheader' => [
'config' => [
'eval' => 'required'
]
],
'image' => [
'config' => [
'maxitems' => '4',
'minitems' => '1'
]
],
],
],
],
];
$GLOBALS['TCA']['tt_content'] = array_replace_recursive($GLOBALS['TCA']['tt_content'], $tca);
},
'theme'
);
// typoscript setup:
// if fsc isn't already included:
<INCLUDE_TYPOSCRIPT: source="FILE: EXT:fluid_styled_content/Configuration/TypoScript/Static/setup.txt">
// set override paths for custom fluid_styled_content
lib.fluidContent {
templateRootPaths.10 = EXT:theme/Resources/Private/Templates/Content/
}
tt_content {
theme_sujet =< lib.fluidContent
theme_sujet {
templateName = Sujet
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = image
as = sliderImages
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment