Mercurial > hg > cmmr2012-drupal-site
view 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 |
line wrap: on
line source
<?php namespace Drupal\{{ machine_name }}\PathProcessor; use Drupal\Core\PathProcessor\InboundPathProcessorInterface; use Drupal\Core\PathProcessor\OutboundPathProcessorInterface; use Drupal\Core\Render\BubbleableMetadata; use Symfony\Component\HttpFoundation\Request; /** * Path processor to replace 'node' with 'content' in URLs. */ class {{ class }} implements InboundPathProcessorInterface, OutboundPathProcessorInterface { /** * {@inheritdoc} */ public function processInbound($path, Request $request) { return preg_replace('#^/content/#', '/node/', $path); } /** * {@inheritdoc} */ public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) { return preg_replace('#^/node/#', '/content/', $path); } }