Integrate variable content element header level

Use hidden for fluid if selected.
Calculate concrete h level based on selected one plus relative level,
which is 1 for now.
This commit is contained in:
Daniel Siepmann 2019-11-28 13:07:21 +01:00
parent 9d39eac0b9
commit ad4fee5213
3 changed files with 26 additions and 4 deletions

View file

@ -12,6 +12,29 @@ lib.contentElement {
10 = EXT:ds_site/Resources/Private/Layouts/ContentElements/
}
variables {
headerLayout = COA
headerLayout {
10 = TEXT
10 {
if {
value = 100
equals.field = header_layout
}
value = hidden
}
20 = TEXT
20 {
if {
value = 100
isLessThan.field = header_layout
}
stdWrap.dataWrap = {field:header_layout} + 1
prioriCalc = intval
}
}
}
stdWrap {
editIcons = tt_content:
editIcons {

View file

@ -4,7 +4,7 @@
<f:render section="Header" arguments="{_all}" optional="1">
{f:render(partial: 'Header', arguments: {
uid: data.uid,
layout: data.header_layout,
layout: headerLayout,
header: data.header
})}
</f:render>

View file

@ -1,8 +1,7 @@
<html xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true">
<a name="c{uid}"></a>
<f:if condition="{layout} != 100">
<!-- TODO: Map header_layout and use mapped value -->
<h2>{header} <small><a href="#c{uid}"></a></small></h2>
<f:if condition="{layout} != 'hidden'">
<h{layout}>{header} <small><a href="#c{uid}"></a></small></h{layout}>
</f:if>
</html>