Mercurial > hg > cmmr2012-drupal-site
comparison vendor/chi-teck/drupal-code-generator/templates/d8/service/path-processor.twig @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\{{ machine_name }}\PathProcessor; | |
4 | |
5 use Drupal\Core\PathProcessor\InboundPathProcessorInterface; | |
6 use Drupal\Core\PathProcessor\OutboundPathProcessorInterface; | |
7 use Drupal\Core\Render\BubbleableMetadata; | |
8 use Symfony\Component\HttpFoundation\Request; | |
9 | |
10 /** | |
11 * Path processor to replace 'node' with 'content' in URLs. | |
12 */ | |
13 class {{ class }} implements InboundPathProcessorInterface, OutboundPathProcessorInterface { | |
14 | |
15 /** | |
16 * {@inheritdoc} | |
17 */ | |
18 public function processInbound($path, Request $request) { | |
19 return preg_replace('#^/content/#', '/node/', $path); | |
20 } | |
21 | |
22 /** | |
23 * {@inheritdoc} | |
24 */ | |
25 public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) { | |
26 return preg_replace('#^/node/#', '/content/', $path); | |
27 } | |
28 | |
29 } |