Skip to content

Instantly share code, notes, and snippets.

@witrin
Last active October 7, 2015 20:28
Show Gist options
  • Save witrin/3220650 to your computer and use it in GitHub Desktop.
Save witrin/3220650 to your computer and use it in GitHub Desktop.
TypoGento - Generic Routes
/**
* Setup generic routes for dispatching and rendering
*/
config.tx_typogento {
# Defines the TypoGento routes for dispatching and rendering
routes {
# Dispatch route for GET parameters
10 {
# True if GP:tx_typogento|route and GP:tx_typogento|controller are set
filter {
isFalse.cObject = COA
isFalse.cObject {
10 = TEXT
10.value = 1
10.if.isFalse.data = GP:tx_typogento|route
20 = TEXT
20.value = 1
20.if.isFalse.data = GP:tx_typogento|controller
}
}
# Use the GET parameters
target {
parameter.cObject = COA
parameter.cObject {
10 = TEXT
10 {
wrap = mage:/|/
data = GP:route
}
20 = TEXT
20 {
wrap = |/
data = GP:controller
}
30 = TEXT
30 {
wrap = |/
value = index
override.data = GP:action
}
40 = TEXT
40 {
wrap = id/|/
data = GP:id
if.isTrue.data = GP:id
}
}
# Excludes primary route parameters (see above)
addQueryString = 1
addQueryString.exclude = route,controller,action,id
}
# Dispatch route
section = dispatch
# Top priority
priority = 2
}
# Dispatch route for FlexForm parameters
20 {
# True if register:tx_typogento.content.route and register:tx_typogento.content.controller are set
filter {
isFalse.cObject = COA
isFalse.cObject {
10 = TEXT
10.value = 1
10.if.isFalse.data = register:tx_typogento.content.route
20 = TEXT
20.value = 1
20.if.isFalse.data = register:tx_typogento.content.controller
}
}
# Use the FlexForm parameters
target {
parameter.cObject = COA
parameter.cObject {
10 = TEXT
10 {
wrap = mage:/|/
data = register:tx_typogento.content.route
}
20 = TEXT
20 {
wrap = |/
data = register:tx_typogento.content.controller
}
30 = TEXT
30 {
wrap = |/
value = index
override.data = register:tx_typogento.content.action
}
40 = TEXT
40 {
wrap = id/|/
data = register:tx_typogento.content.id
if.isTrue.data = register:tx_typogento.content.id
}
}
# Excludes primary route parameters (see above)
addQueryString = 1
addQueryString.exclude = route,controller,action,id
}
# Dispatch route
section = dispatch
# Second highest priority
priority = 1
}
# Fallback dispatch route
30 {
# Always true
filter {
isTrue = 1
}
# Use constant route
target {
parameter = mage:/cms/index/index
# Disable query string
addQueryString = 0
}
# Dispatch route
section = dispatch
# Lowest priority
priority = 0
}
# Generic render route
40 {
# Always true
filter.isTrue = 1
# Link to the current page including almost all query parameter
target {
# Targets the current page
parameter.data = TSFE:id
# Adds all query parameter except the SID
addQueryString = 1
addQueryString.exclude = tx_typogento[SID]
}
# Sets the route section
section = render
}
# Render route for the Ajax action URLs
50 {
# See http://wiki.typo3.org/TSref/if
filter {
# Filters all Ajax actions
value = /checkout/onepage/saveMethod/,/checkout/onepage/progress/,/checkout/onepage/saveBilling/,/checkout/onepage/getAdditional/,/checkout/onepage/saveShipping/,/checkout/onepage/saveShippingMethod/,/checkout/onepage/savePayment/,/checkout/onepage/saveOrder/
isInList.dataWrap = /{GP:route}/{GP:controller}/{GP:action}/
}
# See http://wiki.typo3.org/TSref/typolink
target {
# Targets the current page
parameter.data = TSFE:id
# Adds all query parameter
addQueryString = 1
# Sets the type number for ajax
additionalParams.cObject = TEXT
additionalParams.cObject.value = &type={$plugin.tx_typogento.ajax.typeNumber}
}
# Sets the route section
section = render
# Sets the priority higher as default
priority = 1
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment