newzero
7/10/2014 - 10:31 PM

How to configure gridelements for Typo3 purely with TypoScript and TSconfig and thus living in files. Based on this article: http://www.netw

How to configure gridelements for Typo3 purely with TypoScript and TSconfig and thus living in files. Based on this article: http://www.networkteam.com/blog/post/gridelements-professionell-nutzen.html

# setup:
# no need to include static file anymore:
<INCLUDE_TYPOSCRIPT: source=FILE:EXT:gridelements/static/gridelements/setup.txt>

tt_content.gridelements_pi1.20.10.setup {
	# Two Columns
	1 < lib.gridelements.defaultGridSetup
	1 {
		columns {
			# 401 reflects colPos
			401 < .default
			401 {
				
				preCObject = CASE
				preCObject {
					key.field = flexform_columnType
					cols-1-2 = TEXT
					cols-1-2 {
						value = <div class="span4">
					}
					cols-2-1 = TEXT
					cols-2-1 {
						value = <div class="span8">
					}
					cols-1-3 = TEXT
					cols-1-3 {
						value = <div class="span3">
					}
					cols-3-1 = TEXT
					cols-3-1 {
						value = <div class="span9">
					}
					default = TEXT
					default {
						value = <div class="span6">
					}
				}
				wrap = |</div>
			}
			
			402 < .default
			402 {
				preCObject = CASE
				preCObject {
					key.field = flexform_columnType
					cols-1-2 = TEXT
					cols-1-2 {
						value = <div class="span8">
					}
					cols-2-1 = TEXT
					cols-2-1 {
						value = <div class="span4">
					}
					cols-1-3 = TEXT
					cols-1-3 {
						value = <div class="span9">
					}
					cols-3-1 = TEXT
					cols-3-1 {
						value = <div class="span3">
					}
					default = TEXT
					default {
						value = <div class="span6">
					}
				}
				wrap = |</div>
			}
		}
		wrap = <div class="row">|</div>
	}
}
# Page TSConfig:
tx_gridelements.setup {
	# ID of Element
	1 {
	title = Two Columns
	config {
		colCount = 2
		rowCount = 1
		rows {
		1 {
			columns {
			1 {
				name = Left
				colPos = 401
			}
			2 {
				name = Right
				colPos = 402
			}
			}
		}
		}
	}
	icon = EXT:nxbase/ext_icon.gif

	flexformDS (
			<T3DataStructure>
				<meta>
					<langDisable>1</langDisable>
				</meta>
				<ROOT type="array">
					<type>array</type>
					<el type="array">
					<columnType type="array">
						<TCEforms type="array">
						<label>Column Type</label>
						<config type="array">
							<type>select</type>
							<items type="array">
							<numIndex index="0" type="array">
								<numIndex index="0">1:1</numIndex>
								<numIndex index="1">cols-1-1</numIndex>
							</numIndex>
							<numIndex index="1" type="array">
								<numIndex index="0">1:2</numIndex>
								<numIndex index="1">cols-1-2</numIndex>
							</numIndex>
							<numIndex index="2" type="array">
								<numIndex index="0">2:1</numIndex>
								<numIndex index="1">cols-2-1</numIndex>
							</numIndex>
							<numIndex index="3" type="array">
								<numIndex index="0">1:3</numIndex>
								<numIndex index="1">cols-1-3</numIndex>
							</numIndex>
							<numIndex index="4" type="array">
								<numIndex index="0">3:1</numIndex>
								<numIndex index="1">cols-3-1</numIndex>
							</numIndex>
							</items>
						</config>
						</TCEforms>
					</columnType>
					</el>
				</ROOT>
			</T3DataStructure>
		)
	}
}