Skip to content

Commit

Permalink
Add a two column layout to test PageLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Opitz committed Jun 7, 2021
1 parent 4311c8d commit a633a77
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Resources/Private/DataStructure/Pages/TwoColumn.tvp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3DataStructure>
<meta type="array">
<title>Two Column Page</title>
<description>Place a description here</description>
</meta>
<ROOT type="array">
<el type="array">
<field_content_col1 type="array">
<TCEforms type="array">
<label>Left Column</label>
<config type="array">
<type>group</type>
<internal_type>db</internal_type>
<allowed>tt_content</allowed>
<size>5</size>
<maxitems>200</maxitems>
<minitems>0</minitems>
<multiple>1</multiple>
<show_thumbs>1</show_thumbs>
</config>
</TCEforms>
</field_content_col1>
<field_content_col2 type="array">
<TCEforms type="array">
<label>Right Column</label>
<config type="array">
<type>group</type>
<internal_type>db</internal_type>
<allowed>tt_content</allowed>
<size>5</size>
<maxitems>200</maxitems>
<minitems>0</minitems>
<multiple>1</multiple>
<show_thumbs>1</show_thumbs>
</config>
</TCEforms>
</field_content_col2>
</el>
</ROOT>
</T3DataStructure>
91 changes: 91 additions & 0 deletions Resources/Private/Mappings/Pages/TwoColumn.tvp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
tvp-mapping:
meta:
name: Two column Demo Page
combinedDataStructureIdentifier: 'EM\TVP\Theme\Demo\Page\DataStructure:TwoColumn.tvp.xml'
combinedTemplateConfigurationIdentifier: 'EM\TVP\Theme\Demo\Page\Template:TwoColumn.tvp.yaml'
mappingToTemplate:
field_logo:
value: '' #This is default and do not need to be set
dataType: row
dataPath: media
valueProcessing: typoScript
valueProcessing.typoScript: | # YAML Multiline See: https://yaml-multiline.info/
10 = FILES
10 {
references {
table = pages
uid.cObject = COA
uid.cObject {
10 = TEXT
10 {
data = page:uid
if.isTrue.data = page:_LOCALIZED_UID
if.negate = 1
}
20 = TEXT
20 {
data = page:_LOCALIZED_UID
if.isTrue.data = page:_LOCALIZED_UID
}
}
fieldName = media
}
renderObj = COA
renderObj {
10 = IMAGE
10 {
file {
treatIdAsReference = 1
import.data = file:current:uid
}
altText.data = file:current:alternative
titleText.data = file:current:title
params = class="img-fluid"
}
}
}
field_title:
dataType: row
dataPath: title
valueProcessing: stdWrap
valueProcessing.stdWrap: ''
field_author:
dataType: row
dataPath: author
valueProcessing: none #This is default and do not need to be set
field_layout:
dataType: row
dataPath: layout
field_content_col1:
dataType: flexform
dataPath: field_content_col1
valueProcessing: typoScript
valueProcessing.typoScript: |
10 = RECORDS
10.source.current = 1
10.tables = tt_content
10.wrap = <!--TYPO3SEARCH_begin--> | <!--TYPO3SEARCH_end-->
field_content_col2:
dataType: flexform
dataPath: field_content_col2
valueProcessing: typoScript
valueProcessing.typoScript: |
10 = RECORDS
10.source.current = 1
10.tables = tt_content
10.wrap = <!--TYPO3SEARCH_begin--> | <!--TYPO3SEARCH_end-->
field_menu:
dataType: typoscriptObjectPath
dataPath: lib.textmenu
field_copyright:
valueProcessing: typoScript
valueProcessing.typoScript: |
10 = TEXT
10 {
data = date : U
strftime = %Y
noTrimWrap = |&copy; TV+ Website | |
}
65 changes: 65 additions & 0 deletions Resources/Private/Templates/Pages/TwoColumn.tvp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
tvp-template:
meta:
name: Default Demo Page
renderer: 'TVP\Renderer\XPath'
template: '../Files/PageWithContent.html'
header:
meta:
description:
content: The description
css:
bootstrap:
href: EXT:em_tvplus_theme_demo/Resources/Public/Css/bootstrap.css
rel: stylesheet
media: all
javascript:
bootstrap:
src: EXT:em_tvplus_theme_demo/Resources/Public/Javascript/bootstrap.js
mapping:
# This is a demonstration what works and I hope it is a bit self explaining
# Till yet this isn't set in stone and may change in naming and working
# For example OUTER/INNER/ATTRIB are old names but a bit hard to understand
xpath: body[1]
mappingType: outer # This shouldn't be readed as mappingType, as it doesn't map something, this should more read
# as "Take the matched element into account or only its childs", so this needs a naming fix
# renderType?
container:
field_logo:
xpath: "//*[@id='logo']" # Example usage of a complex XPath but, bear in mind this variant is slow!
# Normally you shouldn't use the "//" global path.
mappingType: inner
valueType: html # Defines if the content from the value should be represented as plain string
# and added as TEXTNode or handle as HTMLNodes to be added to the DOM tree.
# a.k.a. HtmlSpecialChar
field_menu:
xpath: header/nav/div
mappingType: inner
valueType: html
field_title:
xpath: main/section/div/h1
mappingType: inner
valueType: plain
field_layout:
xpath: main/section/div/h1
mappingType: attrib
attribName: class
field_content_col1:
xpath: main/section[3]
mappingType: outer
valueType: html
field_content_col2:
xpath: main/section[3]
mappingType: outer
valueType: html
field_nothing1:
xpath: main/section[4]
mappingType: outer
valueType: html
field_author:
xpath: footer/div/p/span
mappingType: inner
valueType: plain
field_copyright:
xpath: footer/div/p
mappingType: inner
valueType: html

0 comments on commit a633a77

Please sign in to comment.