PathProcessorTest.php
Same filename in this branch
Same filename in other branches
- 9 core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php
- 9 core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php
- 8.9.x core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php
- 8.9.x core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php
- 10 core/modules/forum/tests/modules/forum_url_alter_test/src/PathProcessorTest.php
- 10 core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php
- 10 core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php
Namespace
Drupal\forum_url_alter_testFile
-
core/
modules/ forum/ tests/ modules/ forum_url_alter_test/ src/ PathProcessorTest.php
View source
<?php
namespace Drupal\forum_url_alter_test;
use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
use Drupal\Core\PathProcessor\OutboundPathProcessorInterface;
use Drupal\Core\Render\BubbleableMetadata;
use Symfony\Component\HttpFoundation\Request;
/**
* Path processor for url_alter_test.
*/
class PathProcessorTest implements InboundPathProcessorInterface, OutboundPathProcessorInterface {
/**
* {@inheritdoc}
*/
public function processInbound($path, Request $request) {
// Rewrite community/ to forum/.
return preg_replace('@^/community(.*)@', '/forum$1', $path);
}
/**
* {@inheritdoc}
*/
public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
// Rewrite forum/ to community/.
return preg_replace('@^/forum(.*)@', '/community$1', $path);
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
PathProcessorTest | Path processor for url_alter_test. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.