Last active
June 1, 2018 06:21
-
-
Save miteshmap/23fb5389c64b02c2f540a00233a19920 to your computer and use it in GitHub Desktop.
Drupal 8: Service Decorators: OriginalService.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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