Last active
February 19, 2020 03:15
-
-
Save miteshmap/15bfc8be851465f7a39e054ed9d9fb82 to your computer and use it in GitHub Desktop.
Drupal 8: Service Decorators: OriginalServiceOverride.php
This file contains 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_override; | |
use Drupal\custom_decorator_base\OriginalService; | |
use Symfony\Component\HttpFoundation\RequestStack; | |
/** | |
* Class OriginalServiceOverride | |
*/ | |
class OriginalServiceOverride extends OriginalService { | |
/** | |
* Original service object. | |
* | |
* @var \Drupal\custom_decorator_base\OriginalService | |
*/ | |
protected $originalService; | |
/** | |
* OriginalServiceOverride constructor. | |
* | |
* @param \Drupal\custom_decorator_base\OriginalService $original_service | |
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack | |
*/ | |
public function __construct(OriginalService $original_service, RequestStack $request_stack) { | |
$this->originalService = $original_service; | |
parent::__construct($request_stack); | |
} | |
public function helper() { | |
return t('Overridden helper'); | |
} | |
public function newPublicFunction() { | |
return t('use of new available function'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment