class PathProcessor in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/tests/modules/url_alter_test/src/PathProcessor.php \Drupal\url_alter_test\PathProcessor
Path processor for url_alter_test.
Hierarchy
- class \Drupal\url_alter_test\PathProcessor implements InboundPathProcessorInterface
Expanded class hierarchy of PathProcessor
File
- core/
modules/ system/ tests/ modules/ url_alter_test/ src/ PathProcessor.php, line 16 - Contains \Drupal\url_alter_test\PathProcessor.
Namespace
Drupal\url_alter_testView source
class PathProcessor implements InboundPathProcessorInterface {
/**
* {@inheritdoc}
*/
public function processInbound($path, Request $request) {
if (preg_match('!^/user/([^/]+)(/.*)?!', $path, $matches)) {
if ($account = user_load_by_name($matches[1])) {
$matches += array(
2 => '',
);
$path = '/user/' . $account
->id() . $matches[2];
}
}
// Rewrite community/ to forum/.
$path = preg_replace('@^/community(.*)@', '/forum$1', $path);
if ($path == '/url-alter-test/bar') {
$path = '/url-alter-test/foo';
}
return $path;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PathProcessor:: |
public | function |
Processes the inbound path. Overrides InboundPathProcessorInterface:: |