Verified Commit 30f805e5 authored by apaderno's avatar apaderno Committed by apaderno
Browse files

Issue #3257740 by apaderno: Inject the string_translation service in the...

Issue #3257740 by apaderno: Inject the string_translation service in the CKEditorAdvancedTab constructor and use $this->t() to translate strings
parent f5014df8
......@@ -4,6 +4,7 @@
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\editor\Entity\Editor;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -36,10 +37,13 @@ class CKEditorAdvancedTab extends CKEditorPluginBase implements ContainerFactory
* The plugin implementation definition.
* @param \Psr\Log\LoggerInterface $logger
* A logger instance.
* @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager
* The translation manager.
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition, LoggerInterface $logger) {
public function __construct(array $configuration, $plugin_id, array $plugin_definition, LoggerInterface $logger, TranslationInterface $translation_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->logger = $logger;
$this->setStringTranslation($translation_manager);
}
/**
......@@ -49,7 +53,7 @@ public static function create(ContainerInterface $container, array $configuratio
return new static(
$configuration, $plugin_id, $plugin_definition,
$container->get('logger.channel.ckeditor_advanced_tab'),
$container->get('')
$container->get('string_translation')
);
}
......@@ -76,7 +80,7 @@ public function getButtons() {
$path = drupal_get_path('module', 'ckeditor_advanced_tab') . '/icons';
return [
'AdvancedTab' => [
'label' => t('Advanced Tab'),
'label' => $this->t('Advanced Tab'),
'image' => $path . '/link.png',
],
];
......
Supports Markdown
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