Mercurial > hg > cmmr2012-drupal-site
view vendor/chi-teck/drupal-code-generator/templates/d8/service/path-processor.twig @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | c75dbcec494b |
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); } }