Skip to content

Instantly share code, notes, and snippets.

@miteshmap
Last active June 1, 2018 06:21
Show Gist options
  • Select an option

  • Save miteshmap/23fb5389c64b02c2f540a00233a19920 to your computer and use it in GitHub Desktop.

Select an option

Save miteshmap/23fb5389c64b02c2f540a00233a19920 to your computer and use it in GitHub Desktop.
Drupal 8: Service Decorators: OriginalService.php
<?php
namespace Drupal\custom_decorator_base;
use Symfony\Component\HttpFoundation\RequestStack;
/**
* Class OriginalService
*/
class OriginalService implements CustomDecoratorInterface {
/**
* Request stack object.
*
* @var \Symfony\Component\HttpFoundation\RequestStack
*/
protected $requestStack;
/**
* OriginalService constructor.
*
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
*/
public function __construct(RequestStack $request_stack) {
$this->requestStack = $request_stack;
}
public function helper() {
$uri = $this->requestStack->getCurrentRequest()->getRequestUri();
return t('current page uri: :uri', [':uri' => $uri]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment