Created
May 6, 2016 09:50
-
-
Save bwaidelich/5bb5663c3001a7ab4bef2dd683b6458f to your computer and use it in GitHub Desktop.
Tamper Routing MatchResults from a Flow HTTP Component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Your\Package; | |
use TYPO3\Flow\Annotations as Flow; | |
use TYPO3\Flow\Http\Component\ComponentContext; | |
use TYPO3\Flow\Http\Component\ComponentInterface; | |
use TYPO3\Flow\Mvc\Routing\RoutingComponent; | |
use TYPO3\Flow\Utility\Arrays; | |
class DetectSubdomainComponent implements ComponentInterface | |
{ | |
/** | |
* @param ComponentContext $componentContext | |
* @return void | |
*/ | |
public function handle(ComponentContext $componentContext) | |
{ | |
$originalMatchResults = $componentContext->getParameter(RoutingComponent::class, 'matchResults'); | |
// detect subdomain... | |
$newMatchResults = Arrays::arrayMergeRecursiveOverrule($originalMatchResults, ['shop' => 123]); | |
$componentContext->setParameter(RoutingComponent::class, 'matchResults', $newMatchResults); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TYPO3: | |
Flow: | |
http: | |
chain: | |
process: | |
chain: | |
'detectSubdomain': | |
position: 'after routing' | |
component: 'Your\Package\DetectSubdomainComponent' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment