Commit 32103239 authored by alexpott's avatar alexpott

Issue #2095223 by pwolanin, tim.plunkett: Remove t() from LocalTaskDefault now...

Issue #2095223 by pwolanin, tim.plunkett: Remove t() from LocalTaskDefault now that it's in PluginBase.
parent 94ca8a14
......@@ -10,7 +10,6 @@
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\Routing\RouteProviderInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
......@@ -19,13 +18,6 @@
*/
class LocalTaskDefault extends PluginBase implements LocalTaskInterface, ContainerFactoryPluginInterface {
/**
* String translation object.
*
* @var \Drupal\Core\StringTranslation\TranslationInterface
*/
protected $stringTranslation;
/**
* The route provider to load routes by name.
*
......@@ -49,13 +41,10 @@ class LocalTaskDefault extends PluginBase implements LocalTaskInterface, Contain
* The plugin_id for the plugin instance.
* @param array $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translation object.
* @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
* The route provider.
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition, TranslationInterface $string_translation, RouteProviderInterface $route_provider) {
$this->stringTranslation = $string_translation;
public function __construct(array $configuration, $plugin_id, array $plugin_definition, RouteProviderInterface $route_provider) {
$this->routeProvider = $route_provider;
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
......@@ -68,20 +57,10 @@ public static function create(ContainerInterface $container, array $configuratio
$configuration,
$plugin_id,
$plugin_definition,
$container->get('string_translation'),
$container->get('router.route_provider')
);
}
/**
* Translates a string to the current language or to a given language.
*
* See the t() documentation for details.
*/
protected function t($string, array $args = array(), array $options = array()) {
return $this->stringTranslation->translate($string, $args, $options);
}
/**
* {@inheritdoc}
*/
......
......@@ -7,6 +7,7 @@
namespace Drupal\Tests\Core\Menu;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Menu\LocalTaskDefault;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
......@@ -83,7 +84,10 @@ protected function setUp() {
* Setups the local task default.
*/
protected function setupLocalTaskDefault() {
$this->localTaskBase = new LocalTaskDefault($this->config, $this->pluginId, $this->pluginDefinition, $this->stringTranslation, $this->routeProvider);
$container = new ContainerBuilder();
$container->set('string_translation', $this->stringTranslation);
\Drupal::setContainer($container);
$this->localTaskBase = new LocalTaskDefault($this->config, $this->pluginId, $this->pluginDefinition, $this->routeProvider);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment