Skip to content

Instantly share code, notes, and snippets.

@Schweriner
Created August 10, 2020 08:39
Show Gist options
  • Save Schweriner/f8b40a691255ee9d1342db6dd7dc452c to your computer and use it in GitHub Desktop.
Save Schweriner/f8b40a691255ee9d1342db6dd7dc452c to your computer and use it in GitHub Desktop.
CSC Firstheader with FSC
lib.contentElement {
templateRootPaths {
100 = EXT:bruening_website/Resources/Private/Templates/FluidStyledContent/
}
partialRootPaths {
100 = EXT:bruening_website/Resources/Private/Partials/FluidStyledContent/
}
layoutRootPaths {
100 = EXT:bruening_website/Resources/Private/Layouts/FluidStyledContent/
}
}
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.addAttributes.P.class = bodytext
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.addAttributes.P.class.setOnly = exists
lib.isFirstHeader = COA
lib.isFirstHeader {
10 = LOAD_REGISTER
10 {
isFirstHeader.cObject = TEXT
isFirstHeader.cObject {
data = register:isFirstHeader
wrap = |+1
}
}
20 = TEXT
20.data = register:isFirstHeader
20.prioriCalc = intval
}
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:if condition="{header}">
<f:if condition="{defaultCase} !== 1 && {layout} !== '100'">
<f:variable name="addHeaderClass"></f:variable>
<f:if condition="{f:cObject(typoscriptObjectPath: 'lib.isFirstHeader')}==1">
<f:then>
<f:variable name="addHeaderClass">csc-firstHeader</f:variable>
</f:then>
</f:if>
</f:if>
<f:switch expression="{layout}">
<f:case value="1">
<h1 class="{positionClass} {addHeaderClass}">
<f:link.typolink parameter="{link}">{header}</f:link.typolink>
</h1>
</f:case>
<f:case value="2">
<h2 class="{positionClass} {addHeaderClass}">
<f:link.typolink parameter="{link}">{header}</f:link.typolink>
</h2>
</f:case>
<f:case value="3">
<h3 class="{positionClass} {addHeaderClass}">
<f:link.typolink parameter="{link}">{header}</f:link.typolink>
</h3>
</f:case>
<f:case value="4">
<h4 class="{positionClass} {addHeaderClass}">
<f:link.typolink parameter="{link}">{header}</f:link.typolink>
</h4>
</f:case>
<f:case value="5">
<h5 class="{positionClass} {addHeaderClass}">
<f:link.typolink parameter="{link}">{header}</f:link.typolink>
</h5>
</f:case>
<f:case value="6">
<h6 class="{positionClass} {addHeaderClass}">
<f:link.typolink parameter="{link}">{header}</f:link.typolink>
</h6>
</f:case>
<f:case value="100">
<f:comment> -- do not show header -- </f:comment>
</f:case>
<f:defaultCase>
<f:if condition="{default}">
<f:render partial="Header/Header" arguments="{
header: header,
layout: default,
defaultCase: 1,
addHeaderClass: addHeaderClass,
positionClass: positionClass,
link: link}" />
</f:if>
</f:defaultCase>
</f:switch>
</f:if>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment